Bug 6814 - UIAlertview failure
Summary: UIAlertview failure
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 5.99.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-08-31 19:49 UTC by Darren Oakey
Modified: 2012-10-06 20:02 UTC (History)
3 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 Darren Oakey 2012-08-31 19:49:18 UTC
I made a simple monodialog - that opens a uialertview.  It runs fine - you open, click buttons.  do it again - it works.  But keep doing it - and at some random point - the program just falls over.   It's completely repeatable.  Sometimes it takes two clicks - sometimes 5, but it's repeatable.

Here's the output:

Starting iOS simulator 5.1
Launching application
Application launched. PID = 34910
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll [External]
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll [External]
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/System.dll [External]
Thread started: 
Loaded assembly: /Users/darrenoakey/Projects/AForge.NET Framework-2.2.4/Sources/PowerWill/bin/iPhoneSimulator/Debug/PowerWill.exe
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/MonoTouch.Dialog-1.dll [External]
Loaded assembly: /Users/darrenoakey/Projects/DazCommon/bin/Debug/DazCommon.dll
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/Mono.Security.dll [External]
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/MonoTouch.NUnitLite.dll [External]
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/System.Json.dll [External]
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll [External]

  at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x0009f, 0xffffffff>
  at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
  at PowerWill.Application.Main (string[]) [0x00000] in /Users/darrenoakey/Projects/AForge.NET Framework-2.2.4/Sources/PowerWill/Main.cs:17
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>

Native stacktrace:

	0   PowerWill                           0x000908fc mono_handle_native_sigsegv + 284
	1   PowerWill                           0x00005728 mono_sigsegv_signal_handler + 248
	2   libsystem_c.dylib                   0x95e1286b _sigtramp + 43
	3   ???                                 0xffffffff 0x0 + 4294967295
	4   UIKit                               0x0228fe49 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 519
	5   UIKit                               0x0228ff34 -[UIViewAnimationState animationDidStop:finished:] + 73
	6   QuartzCore                          0x0420eb54 _ZN2CA5Layer23run_animation_callbacksEPv + 288
	7   libdispatch.dylib                   0x03896509 _dispatch_main_queue_callback_4CF + 353
	8   CoreFoundation                      0x01113803 __CFRunLoopRun + 2003
	9   CoreFoundation                      0x01112d84 CFRunLoopRunSpecific + 212
	10  CoreFoundation                      0x01112c9b CFRunLoopRunInMode + 123
	11  GraphicsServices                    0x048307d8 GSEventRunModal + 190
	12  GraphicsServices                    0x0483088a GSEventRun + 103
	13  UIKit                               0x0225f626 UIApplicationMain + 1163
	14  ???                                 0x0cce6d05 0x0 + 214854917
	15  ???                                 0x0cce47d8 0x0 + 214845400
	16  ???                                 0x0cce3be8 0x0 + 214842344
	17  ???                                 0x0cce3d3e 0x0 + 214842686
	18  PowerWill                           0x00009ae2 mono_jit_runtime_invoke + 722
	19  PowerWill                           0x0016b35e mono_runtime_invoke + 126
	20  PowerWill                           0x0016f4e4 mono_runtime_exec_main + 420
	21  PowerWill                           0x001748d5 mono_runtime_run_main + 725
	22  PowerWill                           0x00066ce5 mono_jit_exec + 149
	23  PowerWill                           0x00203921 main + 2209
	24  PowerWill                           0x00002ae5 start + 53

Got a SIGSEGV 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 1 Darren Oakey 2012-08-31 20:04:32 UTC
Found the cause of the problem - I'm disposing the alertview in the click event.   dunno why that's bad, or what the alternative is, but it's definitely the problem.
Comment 2 Sebastien Pouliot 2012-09-04 15:16:29 UTC
You're likely* the UIAlertView before it's life is completely over (it's still alive when you're inside the click event). Disposing won't kill the 'native' part of the alert view but if the instance has to go back to managed code then it won't exist anymore. 

* OTOH the type of error that occurs in such condition is often different (exception, not a crash). Can you attach a self-contained test case so we can see what's going on ? and, based on this, suggest the best way to deal with this. Thanks
Comment 3 Sebastien Pouliot 2012-10-06 20:02:19 UTC
Closing (should have closed it with my previous comment)