Bug 11837 - NullReferenceException in Show Current Execution Line
Summary: NullReferenceException in Show Current Execution Line
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Debugger ()
Version: 4.0.3
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Jeffrey Stedfast
: 8310 ()
Depends on:
Reported: 2013-04-17 17:53 UTC by Fredrik Haglund
Modified: 2015-06-23 06:12 UTC (History)
2 users (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 Fredrik Haglund 2013-04-17 17:53:13 UTC
* iOS project compiled in debug mode and deployed to physical device.
* A breakpoint is set in LoadView and debugger stops on this line when executed in simulator.
* When launched on device I can see that the app stops on TouchUp and breaks Xamarin Studio breaks into the debugger (run, step over etc are active).

Last log item
    Resolved pending breakpoint at '/Users/fredrik/Projects/MiniHacks/MiniHacks/MapViewController.cs:34,1' to LoadView [0x00063].

1) No current line is shown
2) When I "Show Current Execution Line" I get an exception.

System.NullReferenceException: Object reference not set to an instance of an object
  at MonoDevelop.Debugger.DebuggingService.ShowCurrentExecutionLine () [0x0000a] in /Users/builder/data/lanes/monodevelop-lion-bs1/fae7c2bd/source/monodevelop/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs:811 
  at MonoDevelop.Debugger.ShowCurrentExecutionLineCommand.Run () [0x00000] in /Users/builder/data/lanes/monodevelop-lion-bs1/fae7c2bd/source/monodevelop/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs:616 
  at MonoDevelop.Components.Commands.CommandHandler.Run (System.Object dataItem) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-bs1/fae7c2bd/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandHandler.cs:61 
  at MonoDevelop.Components.Commands.CommandHandler.InternalRun (System.Object dataItem) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-bs1/fae7c2bd/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandHandler.cs:42 
  at MonoDevelop.Components.Commands.CommandManager.DefaultDispatchCommand (MonoDevelop.Components.Commands.ActionCommand cmd, MonoDevelop.Components.Commands.CommandInfo info, System.Object dataItem, System.Object target, CommandSource source) [0x00076] in /Users/builder/data/lanes/monodevelop-lion-bs1/fae7c2bd/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1097 
  at MonoDevelop.Components.Commands.CommandManager.DispatchCommand (System.Object commandId, System.Object dataItem, System.Object initialTarget, CommandSource source) [0x002d1] in /Users/builder/data/lanes/monodevelop-lion-bs1/fae7c2bd/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1067
Comment 1 Fredrik Haglund 2013-04-17 18:04:25 UTC
The reason it fails in the first place is probably because of a problem cause by an exception happening at the same time. If I set the break point a little bit earlier before creating a Google Map view it will stop as expected.

So even if it is my fault the debugger show show me this and the menu item should give a friendly message and not throw exceptions.

2013-04-17 16:59:11.688 MiniHacks[1334:907] Unhandled managed exception: Objective-C exception thrown.  Name: GMSException Reason: Google Maps SDK for iOS requires GoogleMaps.bundle to be part of your target under 'Copy Bundle Resources' (MonoTouch.Foundation.MonoTouchException)
  at Google.Maps.MapView.FromCamera (RectangleF frame, Google.Maps.CameraPosition camera) [0x00000] in <filename unknown>:0 

Native stacktrace:

	0   MiniHacks                           0x003a9371 mono_handle_native_sigsegv + 244
	1   MiniHacks                           0x003dbb6d sigabrt_signal_handler + 112
	2   libsystem_c.dylib                   0x3b33cd3b _sigtramp + 42
	3   libsystem_c.dylib                   0x3b332fb7 pthread_kill + 58
	4   libsystem_c.dylib                   0x3b36f36b abort + 94
	5   MiniHacks                           0x0043502c monotouch_throw_monotouch_exception + 0
	6   MiniHacks                           0x003a6d49 mono_invoke_unhandled_exception_hook + 92
	7   MiniHacks                           0x00361893 mono_thread_abort + 46
	8   MiniHacks                           0x003a9047 mono_handle_exception_internal + 2138
	9   MiniHacks                           0x003a9115 mono_handle_exception + 12
	10  MiniHacks                           0x003dae29 mono_arm_throw_exception + 132
	11  MiniHacks                           0x0029a0b8 throw_exception + 68
	12  MiniHacks                           0x00435078 monotouch_exception_handler + 0
	13  MiniHacks                           0x00435128 objc_skip_type + 0
	14  CoreFoundation                      0x331cd6cf <redacted> + 626
	15  libobjc.A.dylib                     0x3aec8a49 <redacted> + 128
	16  libc++abi.dylib                     0x3a91511b <redacted> + 78
	17  libc++abi.dylib                     0x3a9151b4 <redacted> + 19
	18  libc++abi.dylib                     0x3a91662b __cxa_rethrow + 94
	19  libobjc.A.dylib                     0x3aec89b5 objc_exception_rethrow + 12
	20  CoreFoundation                      0x331142a1 CFRunLoopRunSpecific + 456
	21  CoreFoundation                      0x331140c9 CFRunLoopRunInMode + 104
	22  GraphicsServices                    0x36cf333b GSEventRunModal + 74
	23  UIKit                               0x350302b9 UIApplicationMain + 1120
	24  MiniHacks                           0x001a0d1c wrapper_managed_to_native_MonoTouch_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 240
	25  MiniHacks                           0x0031f5d0 MiniHacks_Application_Main_string__ + 152
	26  MiniHacks                           0x00277480 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
	27  MiniHacks                           0x00363e2f mono_jit_runtime_invoke + 1054
	28  MiniHacks                           0x003d19ff mono_runtime_invoke + 90
	29  MiniHacks                           0x003d4767 mono_runtime_exec_main + 306
	30  MiniHacks                           0x003d808b mono_runtime_run_main + 482
	31  MiniHacks                           0x0037b413 mono_jit_exec + 94
	32  MiniHacks                           0x00423488 main + 2220
	33  MiniHacks                           0x00181bac start + 52

Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
Comment 2 Jeffrey Stedfast 2013-04-23 12:12:18 UTC
I just fixed the NRE in git master, will look into the other issues shortly
Comment 3 Jeffrey Stedfast 2013-05-06 16:24:55 UTC
should be fixed in 4.0.5
Comment 4 David Karlaš 2015-06-23 06:12:26 UTC
*** Bug 8310 has been marked as a duplicate of this bug. ***