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

Bug #494119 reported by Jeff Prince
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
NUnit Framework
Triaged
Wishlist
Unassigned

Bug Description

[Issue now tracked at https://github.com/nunit/nunit-framework/issues/42]

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?

Revision history for this message
Jeff Prince (wjprince) wrote :

I forgot to mention the working environment: we're running Windows Vista 64 Business and we use nunit-x86.exe. Code is written in C# 3.0 with Visual Studio 2008.

Revision history for this message
Charlie Poole (charlie.poole) wrote :

NUnit will need to be modified in order to avoid passing exceptions back to the calling domain or process. This is planned for 3.0. For 2.5, it's unlikely that we will be making such a major change.

tags: added: feature major
Changed in nunitv2:
importance: Undecided → Wishlist
status: New → Confirmed
status: Confirmed → Triaged
Revision history for this message
Charlie Poole (charlie.poole) wrote :

Postponed to 3.0

affects: nunitv2 → nunit-3.0
summary: - NUnit GUI does not show custom exceptions when running tests in a
- separate AppDomain
+ NUnit does not show custom exceptions when running tests in a separate
+ AppDomain
description: updated
tags: added: github
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.