Running code coverage analysis on VS 2012 throwing exception

后端 未结 2 1904
广开言路
广开言路 2021-01-23 21:27

I suddenly started getting following exception while I am trying to run the code coverage in VS 2012:

Exception was thrown: Code Coverage Analysis engine threw exception

相关标签:
2条回答
  • 2021-01-23 21:37

    I had this error on VS 2012 Premium. I fixed it by applying VS Update 1 and haven't seen it since.

    0 讨论(0)
  • 2021-01-23 21:55

    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.

    0 讨论(0)
提交回复
热议问题