nunit / nunit-vs-adapter

Runs NUnit V2 tests inside the Visual Studio 2012 or later Test Explorer window.
MIT License
50 stars 43 forks source link

When Debugging UI Tests, Visual Studio No Longer Breaks on Exception #150

Closed andkvo closed 7 years ago

andkvo commented 7 years ago

Visual Studio is no longer pausing execution while debugging NUnit/Coypu UI tests. In Debug Output, it is showing an InvalidOperationException and an IOException related to attempting to communicate over a pipe that has already been broken/terminated.

It used to break automatically on these exceptions and let you inspect the program. Now it seems to just crash when it encounters an unhandled exception.

I thought this issue might be related to #143 or just a misconfiguration on my end. But even after using the pre-release adapter provided in #143, this continues to be a problem.

I added the class BreaksOnCoypuExceptionTest to the repro solution I provided in #143 that reproduces this problem.

break-nunit-adapter.zip

andkvo commented 7 years ago

image

When attempting to debug the CoypuExceptionTest (which only throws an exception), it simply exits prematurely and shows this output.

OsirisTerje commented 7 years ago

Does this also happens with the fixed adapter I enclosed on #143 ?

andkvo commented 7 years ago

Yes.

OsirisTerje commented 7 years ago

Well, it works on my machine :-) image

Using this exception setting image

andkvo commented 7 years ago

Yes, that works... but I never had to do that before. And in my actual UI test it caused the execution to break at least 30 times before I had to add a specific exception for Microsoft.CSharp.RuntimeBinder.RuntimeBinderException. Only then did it finally make it to the MissingHtmlException.

Interestingly, immediately after that, it also paused on an exception I hadn't seen before: a "rethrown" MissingHtmlException wrapped in an NUnit.Core.NUnitException. I think that might be important.

I can approximate the old behavior by setting up my Exception Settings like this:

image

But it's not ideal. I have to inspect the .InnerException property to find the problem. And when it pauses, the call stack looks like this:

image

Whereas the call stack used to show my code.

I'm not convinced that something didn't get broken here. It seems like the adapter maybe used to rethrow that NUnitCoreException.InnerException.

andkvo commented 7 years ago

I downgraded to v2.0 of the VS Adapter and used the default exception settings and... it did not pause on the MissingHtmlException. I am going to have to do more investigation to figure out what changed here.

OsirisTerje commented 7 years ago

Ok, at least that makes sense. When you're in there, please also check on the 2.0 adapter whether you get the exception wrapping the same way.

OsirisTerje commented 7 years ago

I'll close this for now. If you find something here that really doesn't work, we can just reopen the issue.