Bug 3555 - NUnit test debugging fails with NullReferenceException:Object reference not set to an instance of an object
Summary: NUnit test debugging fails with NullReferenceException:Object reference not s...
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: NUnit ()
Version: 2.8.6
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Mike Krüger
Depends on:
Reported: 2012-02-21 06:34 UTC by Dmitri
Modified: 2012-03-15 11:10 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Picture with described bug (94.03 KB, image/png)
2012-02-21 06:34 UTC, Dmitri

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Dmitri 2012-02-21 06:34:31 UTC
Created attachment 1396 [details]
Picture with described bug

In Monodevelop under Windows 7 or Windows 2003 with mono 2.10.8 as runtime.
I create NUnit project for c#, write simplest test, toggle breakpoint, select
test in unit tests pane, right click on it, select run test with->mono soft
debugger. View switch to "debug view", execution stops on first breakpoint and
after 2 seconds debugging stops and view switch back to "solution view".
In test result pane i see:
Internal error:
NullReferenceException:Object reference not set to an instance of an object
Server stack trace:
t) [0x00000] in <fiename unknown>:0
at (wrapper remoting-invoke-with-check)
at MonoDevelop.NUnit.External.ExternalTestRunner.Run(IRemoteEventListener
listener, ITestFilter filter, System.String path, Sytem.String suiteName,
System.CollectionGeneric.List'1 supportAssemblies) [0x00000] in <filename
at (wrapper managed-to-native)
object, object[], object[]&)
target, IMethodCallMessage reqMsg) [0x000c2] in

Exception rethrown at [0]:
в System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
в System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData,
Int32 type)
в MonoDevelop.NUnit.External.ExternalTestRunner.Run(IRemoveEventListener
listener, ITestFilter filter, String path, String suiteName, List'1
в MonoDevelop.NUnit.NUnitAssemblyTestSuite.RunUnitTest(UnitTest test, String
suiteName, String pathName, String testName, TestContext testContext)

I can press in this 2 seconds F10/F5 to continue from breakpoint. In this case
I see in test result pane this internal error and test result.

Debuging with Microsoft .NET Debugger in this environment works correct.

Steps to Reproduce:
1.Install clean mono 2.10.8 and MonoDevelop on Windows 2003 R2 or Windows 7.
2.Select Mono 2.10.8 runtime
3.Create new NUnit Library Project or simple c# library with nunit.framework and core 2.4.8
4.Write simple test like Assert.AreEqual(1,1) and set breakpoint to this line.
5.Test->Run test with->Mono soft debugger.

And also, I print this stacktrace manually, because test result pane doesn't
support copy/paste.

And one more related bug was discovered.
If I declare TestAttribute like this:
public void SomeTest()
It work correct with Microsoft .NET debugger. It stops on all breakpoint and
demonstrates expected behavior. But Mono Soft Debugger doesn't stop at any
breakpoint in this case. Also, mono soft debugger throw internal exception,
described in the bug's description and stop debugging.

If I declare TestAttribute like this:
[Test()] // brackets used
public void SomeTest()
Microsoft .NET debugger cease to stop at any breakpoint and finish test with
success. Mono soft debugger begin to stop at breakpoints, but demonstrate
behavior, described in bug's description - throws internal error and stop
Comment 1 Mike Krüger 2012-03-14 05:49:42 UTC
Should be fixed.
Comment 2 Dmitri 2012-03-15 10:37:36 UTC
Still write Internal Error while debugging with mono soft debugger.
MonoDevelop Version: beta
And bug with brackets [Test()] remains.
Comment 3 Mike Krüger 2012-03-15 11:10:37 UTC
It's fixed in 'master' (I just retested this scenario) is an already released version - no chance for me to fix that.