NUnit Test Adapter for Visual Studio

Test execution fails if solution contains native C++ project

Reported by Lukas Fellechner on 2012-11-07
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
NUnit Test Adapter
High
Charlie Poole

Bug Description

My solution contains a native C++ project. If I try to run a unit test from the C# test project, I get the following output:

========== Discover test finished: 0 found (0:00:04,2581721) ==========
------ Discover test started ------
Assembly not supported: D:\GXR\Pacific\Bin\ProcessCrashToolkit.Native_ur.dll
An exception occurred while test discoverer 'NUnitTestDiscoverer' was loading tests. Exception: Object reference not set to an instance of an object.
========== Discover test finished: 0 found (0:00:00,779885) ==========

Please note that I try to start a unit test from a totally different (C#) project.
If I open the Test Explorer and rebuild the solution, I get the same error output.

Charlie Poole (charlie.poole) wrote :

This is a bit of a mystery. The first message "Assembly not supported..." is from the adapter. After it sends the message, it abandons any processing on the invalid assembly and goes on to the next one.

The second message is from the test discovery engine. A known problem with this message is that the null reference appears to occur when the engine is processing a _different_ exception, making debugging a bit hard. Note that we can't tell from the output if that exception is caused by the C++ assembly or by some other assembly processed after it. There are two ways to find out:

1) Drop any other projects from your solution temporarily. No tests will be found, of course, but we'll see whether the second message continues to appear.

2) I can send you a debug build, which will include a few more lines of output as each assembly is processed.

Charlie

If I unload the native project, then the error does not come and I can see my unit tests. So it definitely has to do with the native project. If you can provide me a debug build, then I will send you the output it generates.

See if this gives you any better message in the output window.

If not, I'd say the next step is for one of us to step through
discovery in debug.

Charlie

On Thu, Nov 8, 2012 at 3:40 AM, Lukas Fellechner
<email address hidden> wrote:
> If I unload the native project, then the error does not come and I can
> see my unit tests. So it definitely has to do with the native project.
> If you can provide me a debug build, then I will send you the output it
> generates.
>
> --
> You received this bug notification because you are subscribed to NUnit
> Extended Testing Platform.
> https://bugs.launchpad.net/bugs/1075893
>
> Title:
> Test execution fails if solution contains native C++ project
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunit-vs-adapter/+bug/1075893/+subscriptions

Hi Charlie, actually this solved the problem for me. Seems like this is fixed indirectly by another bugfix in the more recent build. The problem that only the first unit test project gets loaded is also fixed now.

Looking forward to the official release. Thanks for your support!

Charlie Poole (charlie.poole) wrote :

Hmmm.... guess I should release more frequently!

Changed in nunit-vs-adapter:
status: New → Fix Committed
importance: Undecided → High
Changed in nunit-vs-adapter:
assignee: nobody → Charlie Poole (charlie.poole)
milestone: none → 0.94
Changed in nunit-vs-adapter:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers