Falgantil
Falgantil

Reputation: 1310

NotSupportedException on Device

I've started encountering this very odd problem where the app runs fine on the iOS simulator, however when I launch it on Device, it shows the login screen, but upon logging in, it crashes with a "Operation is not supported" exception. The stack trace is completely incomprehensible:

2015-03-19 13:05:58.256 MemberLinkApp[886:353839] Unhandled managed exception: Operation is not supported. (System.NotSupportedException)
  at ObjCRuntime.Runtime.GetGenericMethodDirect (IntPtr obj, IntPtr typeptr, IntPtr methodptr, Int32 paramCount, System.IntPtr* paramptr) [0x00035] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/Runtime.cs:248 
  at ObjCRuntime.Runtime.get_generic_method_direct (IntPtr obj, IntPtr typeptr, IntPtr methodptr, Int32 paramCount, System.IntPtr* paramptr) [0x00000] in /Developer/MonoTouch/Source/maccore/runtime/Delegates.generated.cs:184 
  at (wrapper native-to-managed) ObjCRuntime.Runtime:get_generic_method_direct (intptr,intptr,intptr,int,intptr*)
  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62 
  at UIKit.UIApplication.Main (System.String[] args, Syst
em.String principalClassName, System.String delegateClassName) [0x0001c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:45 
  at MemberLink.App.iOS.Application.Main (System.String[] args) [0x00002] in c:\Projects\memberlink\App\MemberLink.App.iOS\Main.cs:37 
2015-03-19 13:05:58.260 MemberLinkApp[886:353839] critical: Stacktrace:

2015-03-19 13:05:58.261 MemberLinkApp[886:353839] critical: 
Native stacktrace:
2015-03-19 13:05:59.556 MemberLinkApp[886:353839] critical:     0   MemberLinkApp                       0x02b940d1 mono_handle_native_sigsegv + 240
2015-03-19 13:05:59.557 MemberLinkApp[886:353839] critical:     1   MemberLinkApp                       0x02b9947b sigabrt_signal_handler + 102
2015-03-19 13:05:59.558 MemberLinkApp[886:353839] critical:     2   libsystem_platform.dylib            0x30c8c0a3 _sigtramp + 42
2015-03-19 13:05:59.559 MemberLinkApp[886:353839] critical:     3   libsystem_pthread.dylib             0x30c91c97 pthread_kill + 62
2015-03-19 13:05:59.560 MemberLinkApp[886:353839] critical:     4   libsystem_c.dylib                   0x30bb0939 abort + 76
2015-03-19 13:05:59.561 MemberLinkApp[886:353839] critical:     5   MemberLinkApp                       0x02c56b68 fetch_virt_property + 0
2015-03-19 13:05:59.562 MemberLinkApp[886:353839] critical:     6   MemberLinkApp                       0x02b94643 mono_invoke_unhandled_exception_hook + 66
2015-03-19 13:05:59.562 MemberLinkApp[886:353839] critical:     7   MemberLinkApp                       0x02ba10ef mono_thread_abort_dummy + 62
2015-03-19 13:05:59.563 MemberLinkApp[886:353839] critical:     8   MemberL
inkApp                       0x02b93d91 mono_handle_exception_internal + 3964
2015-03-19 13:05:59.564 MemberLinkApp[886:353839] critical:     9   MemberLinkApp                       0x02b92e0f mono_handle_exception + 10
2015-03-19 13:05:59.565 MemberLinkApp[886:353839] critical:     10  MemberLinkApp                       0x02b8ca93 mono_arm_throw_exception + 110
2015-03-19 13:05:59.566 MemberLinkApp[886:353839] critical:     11  MemberLinkApp                       0x00f8a780 rethrow_exception + 68
2015-03-19 13:05:59.567 MemberLinkApp[886:353839] critical:     12  MemberLinkApp                       0x00f2d5d4 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
2015-03-19 13:05:59.568 MemberLinkApp[886:353839] critical:     13  MemberLinkApp                       0x02ba0893 mono_jit_runtime_invoke + 1162
2015-03-19 13:05:59.569 MemberLinkApp[886:353839] critical:     14  MemberLinkApp                       0x02be8739 mono_runtime_invoke + 88
2015-03-19 13:05:59.570 MemberLinkApp[886:353839] critical:     15  MemberLinkApp                       0x02bebc4b mono_runtime_exec_main + 282
2015-03-19 13:05:59.571 MemberLinkApp[886:353839] critical:     16  MemberLinkApp                       0x02beba89 mono_runtime_run_main + 492
2015-03-19 13:05:59.571 MemberLinkApp[886:353839] critical:     17  MemberLinkApp                       0x02b8a819 mono_jit_exec + 48
2015-03-19 13:05:59.572 MemberLinkApp[886:353839] critical:     18  MemberLinkApp                       0x02c511bc xamarin_main + 2172
2015-03-19 13:05:59.573 MemberLinkApp[886:353839] critical:     19  MemberLinkApp                       0x02b6d33d main + 108
2015-03-19 13:05:59.574 MemberLinkApp[886:353839] critical:     20  libdyld.dylib                       0x30b4baaf <redacted> + 2
2015-03-19 13:05:59.575 MemberLinkApp[886:353839] critical: 
================================

Even when I enable breaking on all exceptions, it still doesn't break until Main.

I have already concluded the HTTP works fine, because the logging-in feature works without a hitch. At this point I am clueless as to what the problem is, cause like I said, it works fine on simulator.

OS & software info:

Nuget Packages:

Other libraries:

Other tech:

@Edit: Upon further testing, I have concluded that this exception is thrown when I set the ViewControllers property on my UITabBarController

Upvotes: 1

Views: 186

Answers (1)

Falgantil
Falgantil

Reputation: 1310

Weirdest problem ever, but I figured it out.

So this works fine:

MyViewController : MvvmViewController<RandomViewModel>

However, as soon as I do this:

EmbeddedViewController : MvvmViewController<RandomViewModel>

and use it in a Container View (a control you can only place through a designer, since it's doing some magic under the hood), it gets MAD. And not just a little, but REALLY mad.

So what I had to do, was inherit directly from UIViewController, and then it worked.

The only thing I can see should be a problem, is that I inherit from a class that takes a Generic parameter, and we all know how much iOS hates generics.

Upvotes: 1

Related Questions