Partcover/NDepend Export and .NET5 Support

by Remco 31. October 2020 10:40

I'm happy to announce the release of NCrunch v4.5, which includes support for the new .NET5 and VS2019.16.8, along with the ability to export NCrunch coverage data in partcover format.


.NET5 and VS2019.16.8

NCrunch v4.5 is the first build to officially support .NET5.  This means that it can build .NET5 targeted projects, can launch test processes under .NET5 and run tests within the .NET5 environment.

We were fortunate in finding that adding support for this new platform was far easier than we were expecting, as internally the platform seems to function very similarly to .NET Core/Standard.  This shows that the rapid evolution of Microsoft platforms has been stabilising well and is becoming more consistent over time.  We've tested NCrunch through the new platform as best as we are able to, though it's expected that there will be changes and developments that we are not aware of.  As such, please be patient in reporting problems encountered with .NET5 as we are all still finding our feet here.

VS2019.16.8 also required some minor tweaks to handle correctly, so we can't warrant that older versions of NCrunch will work correctly under this version of VS and we strongly recommend updating to v4.5 as soon as possible if you are updating your IDE.


Partcover Export / NDepend Support

v4.5 introduces the ability to export code coverage data in partcover format.  Although we hope this will also work with other tools, the primary use case for this is to allow the transfer of NCrunch's code coverage data into NDepend for analysis.

Although exporting code coverage into XML seems like a very basic thing to implement, this was actually surprisingly difficult, which is why it wasn't implement earlier in NCrunch's life.

For performance reasons, NCrunch tracks coverage on a document line basis, not on the basis of IL-level sequence points.  This means that we can't export coverage data that is compatible with tools like NDepend without a way to map the document lines to the IL assembly structure.  Naturally, we can easily generate this map when we instrument an assembly, but there is always a cost involved and without special handling this would increase the time taken to build every assembly, regardless of whether an export was even taking place.

To work around this, we've introduced a new build mode where NCrunch will rebuild the solution and map the coverage data only when the export option has been selected from the Tests Window.  This means it might take a little longer to perform the export, but we won't end up slowing down the engine for the more common scenario where there is no export happening.

To perform an export in Partcover format, simply choose the option from the Export button on the toolbar of the NCrunch Tests Window.  NCrunch will then rebuild the solution in the background and generate the export.  When this is ready, you'll receive a dialog allowing you to choose the export target file.

Under the NCrunch console tool, the Partcover export will happen automatically with the export file being present with the other console tool reports, under the name 'Opencover.xml'.  This should make it possible to script the loading of this file into other tools as part of your CI.

Once the data is in NDepend, you can freely analyse it in all its glory.


Other Fixes/Improvements

As usual, this new version of NCrunch includes a range of minor fixes and improvements implemented in response to issues reported since the last version.

See here for the full list of changes in v4.5

Go grab it now!


Month List

Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download