Bug 11016 - NullReferenceException in MonoDevelop.Debugger.DebuggingService.Cleanup
Summary: NullReferenceException in MonoDevelop.Debugger.DebuggingService.Cleanup
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Debugger ()
Version: Trunk
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Jeffrey Stedfast
Depends on:
Reported: 2013-03-09 05:42 UTC by Andres G. Aragoneses
Modified: 2013-03-09 18:21 UTC (History)
1 user (show)

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

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 Andres G. Aragoneses 2013-03-09 05:42:36 UTC
Just got this using MD master:

ERROR [2013-03-09 10:41:06Z]: Error handling debugger target event
System.NullReferenceException: Object reference not set to an instance of an object
  at MonoDevelop.Debugger.DebuggingService.Cleanup () [0x00088] in /home/andres1210/Code/system_mono/monodevelop/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs:375 
  at MonoDevelop.Debugger.DebuggingService.OnTargetEvent (System.Object sender, Mono.Debugging.Client.TargetEventArgs args) [0x00033] in /home/andres1210/Code/system_mono/monodevelop/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs:631
Comment 1 Andres G. Aragoneses 2013-03-09 05:59:06 UTC
Pull request proposed: https://github.com/mono/monodevelop/pull/251
Comment 2 Jeffrey Stedfast 2013-03-09 08:23:11 UTC
Ugh, looks like a race...

I don't think your patch will fix it (though the typo fixes would be nice) because a few lines above your:

if (session != null) {

block, there is a:

if (!IsDebugging)

...and IsDebugging just returns session != null, so there's already a session != null check just a few lines above the one you added.
Comment 3 Andres G. Aragoneses 2013-03-09 08:29:17 UTC
Oh I see.

Well, even being a race, with my patch in place the bug would be less likely to be hit, right? I would commit it, unless you manage to locate and fix the race condition...
Comment 4 Andres G. Aragoneses 2013-03-09 08:32:45 UTC
Actually, scratch my comment. If there's a race I guess it's better to try to expose it (fail fast) so you guys can try to fix it.

I can create a different branch for a new PR where I cherrypick the typos if you want.
Comment 5 Andres G. Aragoneses 2013-03-09 08:41:48 UTC
> I can create a different branch for a new PR where I cherrypick the typos

Done: https://github.com/mono/monodevelop/pull/252
Comment 6 Jeffrey Stedfast 2013-03-09 18:21:43 UTC
Okay, the race *should* be fixed in git now (I hope).