Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NUnit does not show custom exceptions when running tests in a separate AppDomain #42

Closed
CharliePoole opened this issue Oct 28, 2013 · 1 comment

Comments

@CharliePoole
Copy link
Contributor

If a test throws one of our custom exception types (e.g., InterfaceBrokerException) and you're running tests via the NUnit GUI, then NUnit shows the following instead of the exception that was actually thrown:

An unhandled System.Runtime.Serialization.SerializationException was thrown while executing this test : Unable to find assembly 'Profitstar.Library, Version=2008.2.338.27793, Culture=neutral, PublicKeyToken=null'.

This is because the tests get run in one AppDomain, and then the results are marshaled to the main AppDomain via .NET serialization; but the Profitstar.Library assembly isn't loaded into the main AppDomain (nor should it be, because then it couldn't be unloaded), so it can't deserialize the exception.

So we end up with no stack trace, no original exception message, and no idea of even what exception type got thrown.

Is there any way to circumvent the use of a separate AppDomain when using the NUnit GUI? If not, can something be added to configure that feature?

See discussion at https://bugs.launchpad.net/nunit-3.0/+bug/494119

@CharliePoole CharliePoole added this to the Future milestone Jul 30, 2014
@CharliePoole CharliePoole modified the milestones: Future, Backlog Dec 4, 2015
@CharliePoole CharliePoole removed this from the Backlog milestone Jul 25, 2016
@CharliePoole
Copy link
Contributor Author

I don't believe this issue is relevant to NUnit 3 any longer. We still create a test AppDomain but exceptions thrown by the tests are no longer allowed to escape. The test execution code is contained in the framework itself and the exception is transformed into an NUnit TestResult in XML format before it is returned to the original AppDomain.

I'm closing the issue but if anyone thinks I have missed something, you can still add a comment here, which the developers will review.

@rprouse rprouse modified the milestone: Closed Without Action Jan 10, 2017
johnmwright pushed a commit to johnmwright/nunit that referenced this issue Oct 28, 2019
Set NumberOfTestWorkers to zero when running under the debugger. Fixes nunit#36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants