Bug 5139 - Exceptions when using static classes with MonoTouch 5.3.3
Summary: Exceptions when using static classes with MonoTouch 5.3.3
Status: RESOLVED DUPLICATE of bug 4864
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 5.3.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-05-17 09:06 UTC by René Ruppert
Modified: 2012-05-19 12:14 UTC (History)
3 users (show)

Tags:
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:
Status:
RESOLVED DUPLICATE of bug 4864

Description René Ruppert 2012-05-17 09:06:54 UTC
I'm getting various totally random exception and my app does not start at all if I use MT 5.3.3. First I had to add the "--noregistrar" arguments to make it build at all. Then I'm getting this when it starts.
The line in question (AppDelegateBase.cs, l. 732) is:

this.oWindow = new UIWindow (UIScreen.MainScreen.Bounds);

All the exception I get are in combination with static classed (UIScreen.MainScreen). Another one is o.BackgroundColor = UIHelpers.COLOR_BACK, where COLOR_BACK is a static UIColor.FromRGB().

May 17 14:58:01 unknown BrainloopBrowser[968] <Warning>: UNHANDLED EXCEPTION CAUGHT
May 17 14:58:01 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: [ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidCastException: Cannot cast from source type to destination type.
May 17 14:58:01 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>:   at MonoTouch.UIKit.UIScreen.get_MainScreen () [0x00001] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIScreen.g.cs:135 
May 17 14:58:01 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>:   at BrainloopMobile.AppDelegateBase.FinishedLaunching (MonoTouch.UIKit.UIApplication application, MonoTouch.Foundation.NSDictionary launchOptions) [0x0011c] in /Users/rene/Documents/Develop/Projects/BrainloopMobile/210/BrainloopMobile/BrainloopMobile/AppDelegateBase.cs:732 
May 17 14:58:01 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>:   at BrainloopMobile.AppDelegateIPad.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x00000] in /Users/rene/Documents/Develop/Projects/BrainloopMobile/210/BrainloopMobile/BrainloopMobile/AppDelegateIPad.cs:24 
May 17 14:58:01 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>:   at MonoTouch.UIKit.UIApplication.SendEvent (MonoTouch.UIKit.UIEvent uievent) [0x00038] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.g.cs:175 
May 17 14:58:01 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>:   at BrainloopMobile.UIApplicationMain.SendEvent (MonoTouch.UIKit.UIEvent oEvent) [0x00000] in /Users/rene/Documents/Develop/Projects/BrainloopMobile/210/BrainloopMobile/BrainloopMobile/UIApplicationMain.cs:23 
May 17 14:58:01 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>:   at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38 
May 17 14:58:01 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>:   at BrainloopMobile.Application.Main (System.String[] args) [0x00000] in /Users/rene/Documents/Develop/Projects/BrainloopMobile/210/BrainloopMobile/BrainloopMobile/Main.cs:15 
May 17 14:58:01 unknown BrainloopBrowser[968] <Critical>: Terminating runtime due to unhandled exception
May 17 14:58:01 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: Stacktrace:
May 17 14:58:01 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: Native stacktrace:
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	0   BrainloopBrowser                    0x00e0a9f1 mono_handle_native_sigsegv + 244
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	1   BrainloopBrowser                    0x00e21b59 sigabrt_signal_handler + 112
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	2   libsystem_c.dylib                   0x34d1c7ed _sigtramp + 48
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	3   libsystem_c.dylib                   0x34d1220f pthread_kill + 54
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	4   libsystem_c.dylib                   0x34d0b29f abort + 94
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	5   BrainloopBrowser                    0x00eac5cb monoeg_assertion_message + 58
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	6   BrainloopBrowser                    0x00dfb09d mono_thread_abort + 112
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	7   BrainloopBrowser                    0x00e0a76f mono_handle_exception_internal + 2138
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	8   BrainloopBrowser                    0x00e0a83d mono_handle_exception + 12
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	9   BrainloopBrowser                    0x00e20e15 mono_arm_throw_exception + 116
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	10  BrainloopBrowser                    0x00e20d9b mono_arm_throw_exception_by_token + 46
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	11  BrainloopBrowser                    0x007ca9d8 throw_corlib_exception + 44
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	12  BrainloopBrowser                    0x00bb4ad4 BrainloopMobile_AppDelegateBase_FinishedLaunching_MonoTouch_UIKit_UIApplication_MonoTouch_Foundation_NSDictionary + 2268
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	13  BrainloopBrowser                    0x00badbc0 BrainloopMobile_AppDelegateIPad_FinishedLaunching_MonoTouch_UIKit_UIApplication_MonoTouch_Foundation_NSDictionary + 144
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	14  BrainloopBrowser                    0x0078e8c8 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	15  BrainloopBrowser                    0x00dfce5f mono_jit_runtime_invoke + 1054
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	16  BrainloopBrowser                    0x00e675a7 mono_runtime_invoke + 90
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	17  BrainloopBrowser                    0x00ebb560 monotouch_trampoline + 3556
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	18  UIKit                               0x30764cab -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1182
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	19  UIKit                               0x3075e7dd -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 408
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	20  UIKit                               0x3072cac3 -[UIApplication handleEvent:withNewEvent:] + 1010
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	21  UIKit                               0x3072c567 -[UIApplication sendEvent:] + 54
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	22  BrainloopBrowser                    0x0035cfdc wrapper_managed_to_native_MonoTouch_ObjCRuntime_Messaging_void_objc_msgSendSuper_IntPtr_intptr_intptr_intptr + 76
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	23  BrainloopBrowser                    0x00bef058 BrainloopMobile_UIApplicationMain_SendEvent_MonoTouch_UIKit_UIEvent + 144
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	24  BrainloopBrowser                    0x0078e8c8 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	25  BrainloopBrowser                    0x00dfce5f mono_jit_runtime_invoke + 1054
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	26  BrainloopBrowser                    0x00e675a7 mono_runtime_invoke + 90
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	27  BrainloopBrowser                    0x00ebb560 monotouch_trampoline + 3556
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	28  UIKit                               0x3072bf3b _UIApplicationHandleEvent + 5826
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	29  GraphicsServices                    0x3774822b PurpleEventCallback + 882
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	30  CoreFoundation                      0x375cc523 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 38
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	31  CoreFoundation                      0x375cc4c5 __CFRunLoopDoSource1 + 140
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	32  CoreFoundation                      0x375cb313 __CFRunLoopRun + 1370
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	33  CoreFoundation                      0x3754e4a5 CFRunLoopRunSpecific + 300
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	34  CoreFoundation                      0x3754e36d CFRunLoopRunInMode + 104
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	35  UIKit                               0x3075d86b -[UIApplication _run] + 550
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	36  UIKit                               0x3075acd5 UIApplicationMain + 1080
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	37  BrainloopBrowser                    0x00363a78 wrapper_managed_to_native_MonoTouch_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 240
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	38  BrainloopBrowser                    0x00bad668 BrainloopMobile_Application_Main_string__ + 160
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	39  BrainloopBrowser                    0x0078e8c8 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	40  BrainloopBrowser                    0x00dfce5f mono_jit_runtime_invoke + 1054
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	41  BrainloopBrowser                    0x00e675a7 mono_runtime_invoke + 90
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	42  BrainloopBrowser                    0x00e6a173 mono_runtime_exec_main + 306
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	43  BrainloopBrowser                    0x00e6a3c7 mono_runtime_run_main + 482
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	44  BrainloopBrowser                    0x00e002c7 mono_jit_exec + 94
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	45  BrainloopBrowser                    0x00eb0acc main + 2540
May 17 14:58:02 unknown UIKitApplication:com.brainloop.brainloopbrowser[0x86c8][968] <Notice>: 	46  BrainloopBrowser                    0x000027f8 start + 40
Comment 1 Sebastien Pouliot 2012-05-17 09:54:41 UTC
That looks identical to #4864 you already reported (and could not be duplicated). Can you supply a test case ?
Comment 2 Sebastien Pouliot 2012-05-19 12:14:25 UTC
Pretty sure it's a dupe. If you can duplicate it with 5.3.4 then please re-open

*** This bug has been marked as a duplicate of bug 4864 ***