I recently blogged about PartCover, a free code coverage utility for .NET. Even more recently, I had the chance to upgrade my development machine to Windows 7 x64. There were a few issues along the way getting PartCover (and NUnit) to work in this environment, but I think I’ve just about got everything working as it was 100%. This article details a few of the problems you may encounter.
Check that PartCover is x86
PartCover has trouble running as an x64 process. I believe the latest release (4.0.11129) has been built to run under x86 only, but should you be using an older release, either upgrade, or use corflags to set the PartCover exes to run under 32-bit.
In addition, make sure you run the x86 NUnit console runner – nunit-console-x86.exe, not nunit-console.exe.
Disable Shadow Copying for NUnit
When NUnit runs, it may make copies of the assemblies being used for the tests. If this happens, PartCover will not be able to find the pdb symbol files, and you won’t be able to view your code (although the tree on the left will still get populated). To disable shadow copying, simply specify the /noshadow option:
-
nunit-console-x86.exe /noshadow SomeTests.dll
Thanks to this post for that.
Avoid NUnit 2.5.8 with .NET 4.0
I also found that PartCover would not instrument .NET 4.0 assemblies when using the NUnit 2.5.8 console runner. A symptom of this was an nunit-agent.exe process left hanging around after the tests had run. This appears to be fixed in NUnit 2.5.9, so I advise upgrading to that if you’re on 2.5.8 and want to use PartCover with .NET 4.0 assemblies.
That pretty much sums up my experiences. Good luck getting PartCover to work on x64.