当我尝试在 VS 2012 中运行代码覆盖率时,我突然开始出现以下异常:
抛出异常:代码覆盖分析引擎抛出异常:覆盖文件“........coverage”无效或损坏
任何解决方案/解决方法都会有所帮助。
当我尝试在 VS 2012 中运行代码覆盖率时,我突然开始出现以下异常:
抛出异常:代码覆盖分析引擎抛出异常:覆盖文件“........coverage”无效或损坏
任何解决方案/解决方法都会有所帮助。
I have seen this error in VS2010 and it's frustrating to say the least. The error is likely related to one or more assemblies that don't get "instrumented" correctly, From memory I recall it can be solved by unselecting "instrument assemblies in place" in the test settings.
Regarding "instrumenting in place", when code coverage is turned on Visual Studio takes a few moments before the TestRun to rewrite the IL for your assemblies so that it can record which parts of the IL are executed. "Instrumenting in place" creates a back up of the assembly with a ".instr" extension, runs the tests with the profiler turned on, then replaces the instrumented assembly with the original assembly after the Tests complete. When i was seeing this error it seemed as though the original file could not be restored (possibly locked) and i had a few remnant ".instr" assemblies in my build output folder. My theory is that the IDE tries to correlate the coverage data to the original assembly but fails because of this mismatch.
AFAIK, there are no visible differences to turning off in place instrumentation when viewing coverage locally.
我在 VS 2012 Premium 上遇到了这个错误。我通过应用VS Update 1修复了它,从那以后就再也没有看到它。