Saturday, August 29, 2009

Code coverage measure for F# unit tests

The Feb 2010 CTP ( has resolved this issue. I never looked at whether did.

This one bit me the other day. Doing the usual post-build step for the unit test assembly

Ncover.console.exe nunit-console.exe $(TargetFileName) //reg

left me with no coverage data for my F# and a lot of "Failed to load symbols" messages in the log file for the F# assemblies in nUnit's shadow copy cache.

Turns out that whereas C# assemblies have absolute paths to the .pdb baked in, F# (May CTP) has project-relative paths; so the association was being lost. Short of running the F# code through an ILDASM/ILASM cycle, the quickest fix is to turn off shadowing:

Ncover.console.exe nunit-console.exe $(TargetFileName) /noshadow //reg

and NCover 1.5.8 will give you coverage metrics for F# too.

1 comment :

Anonymous said...

FYI, the absolute paths to PDBs have been recently fixed, and so Beta2 & next CTP should behave like C# here.