microsoft / codecoverage

MIT License
84 stars 11 forks source link

Instrumentation with Microsoft.CodeCoverage.console.exe causes program to crash with segmentation fault or behave different #144

Closed dhoelzl closed 2 days ago

dhoelzl commented 3 days ago

When instrumenting DLLs loaded by an executable (all native C and C++) with Microsoft.CodeCoverage.console.exe it stops working and crashes reproducibly with a segementation fault every time it’s launched and a specific execution path is taken. It’s also reproducible that the instrumented code behaves different than expected in another situtation. The situation would also be reproducible if the executable is statically linked and the executable is instrumented instead of the DLL as in this example, so I assume that the fact that DLLs are instrumented is not the root cause of the problem. The problem only occurs in parts of our instrumented code, not all programs / execution paths seem to be affected - if not affected, everything including recording of code coverage works as expected.

Reproduction: See README.txt in attached file:

coverage_problems.zip

Also see https://developercommunity.visualstudio.com/t/Problem-Report:-Instrumentation-with-Mic/10793811

Microsoft.CodeCoverage.console.exe --version
17.10.4+a12555c42042c92e5c5c12399e7ab27a3fec615c
fhnaseer commented 2 days ago

Can you please try this on VS 17.12?

dhoelzl commented 2 days ago

Looks like it works with VS 17.12, thank you!