Software Design Blog

Journey of Rinat Abdullin

How to Run Free NCover on a 64 Bit Machine

There is a great code coverage tool called NCover that collects information about the code statements visited during the test execution. It has turned commercial but last free versions 1.5.8 are still available for download (BTW, you can use this service to skip the registration phase).

Additionally there is a great utility NCoverExplorer that excels at parsing and visualizing these code coverage reports. It also provides means to generate HTML reports and integrate them with CC.NET. It went commercial, too, but the last free version is still great.

NCoverExplorer with some LandorSystems code NCoverExplorer report

The only real benefit of the commercial (enterprise!) version for me was the ability to run NCover on 64 bit machine. Otherwise you would get the dreaded:

Profiled process terminated. Profiler connection not established.

Well, it turns out that you do not need to spend money on that. Here are the steps that worked for Windows Server 2008 64 bit (wasted 40mins on that):

  • Find corflags.exe from .NET 2.0 SDK or Microsoft SDK (on my machine it was in E:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin).
  • Execute it against NCover and your unit test runner (nunit-console.exe in my case) executables with /32BIT+ flag. I.e.:
    –°orFlags.exe NCover.exe /32BIT+
    CorFlags.exe nunit-console.exe /32BIT+

This will actually force NCover and NUnit to run under WOW64 (x86 emulator that allows 32-bit Windows applications to run on 64-bit Windows).

Additionally, if you have the latest NUnit, you do not even have to modify its executable, just use nunit-console-x86.exe (this one has been compiled to run under 32 bits). Kudos to Cygon for brining this up!

PS: BTW, using Windows Server 2008 64 bit as the primary development environment turns out to be really enjoyable experience.