Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NUnit 2.5.7 requires explicit Debug Attach under VS2010

I've just "upgraded" from NUnit 2.5.2 to NUnit 2.5.7 so that I can run unit tests against an DLL's built with .Net Framework 4. I've been using 2.5.2 for a long time via the "StartExternalProgram" property under project properties. I've never had to explicitly debug attach to the NUnit process in that scenario.

Now under 2.5.7 it appears that one must explicitly attach to the NUnit_Agent process in order to debug the code under test.

Of course this means that instead of requiring two clicks to run my unit tests I now have to click Debug.Run icon in VS2010, wait for NUnit GUI to appear, alt-Tab back to VS2010, click Debug.Attach.., scroll down the list to find NUnit Agent, double click to select it, alt-Tab back to NUnit GUI, click Run to run the test(s).

So, is there a reason that using NUnit has become that much more difficult under 2.5.7 or did a ball get dropped?

Thanks in advance for any advice on restoring the "automagic attach" from earlier versions.

like image 1000
Bill Cohagan Avatar asked Nov 26 '25 18:11

Bill Cohagan


1 Answers

The problem is that NUnit is kicking off a child process (nunit-agent.exe.) I was able to fix this by opening up nunit.exe.config and adding the following section:

<startup>
    <supportedRuntime version="v4.0.30319" />
</startup>

Edit: If you still want to use nunit with .Net 2.0, make sure to add that version as well. My config ended up looking like this:

<startup>
    <supportedRuntime version="v2.0.50727" />
    <supportedRuntime version="v4.0.30319" />
</startup>

Edit 2: I also recently found that the order of the entries also makes a difference.

like image 126
Pedro Avatar answered Nov 28 '25 13:11

Pedro



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!