performancecode-coverageopencover

Opencover & Production


If I use opencover to provide coverage anaylsis that runs on the buildserver for all builds of my product.

I'm under the impression that opencover (and presumably all the others) "instrument" the code to record hits.

Is this instrumented code "not safe" and/or slower and therefore I should not be using this code on the production servers?

I'm hoping that I have misunderstood the process as the prospect of having to do 2 builds (1 for coverage testing and actual for production) will slow down the buildserver.


Solution

  • OpenCover (and NCover and PartCover) do not modify your binaries that you have produced via the build. They use the profiler API to instrument the binaries in-memory as they are being JITted (just-in-time compiled).

    As such your binaries remain unmodified and are safe to use in production.