Cannot delete a subkey tree because the subkey does not exis

Cannot delete a subkey tree because the subkey does not exis

Now I'm using the ncover to run the unit tests at the build server, sometimes it runs well, however sometimes it throws an exception by accident: [exec] Unhandled Exception: System.ArgumentException: Cannot delete a subkey tree because the subkey does not exist. [exec] at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) [exec] at Microsoft.Win32.RegistryKey.DeleteSubKeyTree(String subkey) [exec] at NCover.Framework.ProfilerDriver.UnregisterProfilerForUser() [exec] at NCover.ConsoleMain.ConsoleMain.Main(String[] args) [exec] c:\Source\Esb\RF.Esb.build(114,6): External Program Failed: c:\Source\Esb..\ExternalComponent\NCover/NCover.Console.exe (return code was -532459699)

By the way, There are several projects using ncover at the build server run in parallel.


Re: Cannot delete a subkey tree because the subkey does not exis

It sounds like you are using the //reg option to register NCover on the fly. This is dangerous if multiple copies are running in parallel since they are sharing registry keys. There are actually quite a few ways in which this could cause NCover to fail. You've discovered one of the least problematic scenarios.

I'd recommend that you register the NCover profiler library once for the entire server. The install program does this for you. Then remove the //reg option from your command line or the equivalent option from your settings file.


Re: Cannot delete a subkey tree because the subkey does not exis

I've just integrated NCover.Console v2.0.2 (x64) using the MSBuild tasks supplied.

I get the same error message sometimes: Cannot delete a subkey tree because the subkey does not exist.

I'm not passing in the /reg switch. Does the MSBuild task do this by default? Can it be turned off?

Not being able to build several projects in parallel is a real deal breaker.


Re: Cannot delete a subkey tree because the subkey does not exis

I think there's a good chance the MSBuild tasks does the //reg option by default. I've added this to our bug list for investigation. As a workaround, you can simply call NCover using an MSBuild Exec task rather than using the built-in task.


RE: Cannot delete a subkey tree because the subkey

Sorry, bit late to the party here...

The MSBuild and NAnt tasks will register NCover by default. However you can easily override this by adding a RegisterProfiler attribute and setting it to false. If you do this, then you must take responsibility for registering NCover on the box yourself such as the NCover msi installer does, or by using regsvr32.

Regards, Grant.