1
votes

Continuing the journey into vnext...

I can now build the entire solution & run it successfully. However, when I try to initialise the IMvxGeoLocationWatcher, it crashes. The code & output are -

private IMvxGeoLocationWatcher _geoWatcher;

public void StartGettingLocation(Action<MvxCoordinates> response)
{
    Log.Info("LocationService->StartGettingLocation");

    // crashes on this line -
    if (_geoWatcher == null) _geoWatcher = this.GetService<IMvxGeoLocationWatcher>();

Output -

Unhandled Exception: 0 MyApp 0x000797ae mono_handle_exception_internal_first_pass + 2190 1 MyApp 0x0007b1e2 mono_handle_exception_internal + 1602 2 MyApp 0x0007bd2f mono_handle_exception + 47 3 MyApp 0x000bce22 mono_x86_throw_exception + 306 4 ??? 0x07f30f8f 0x0 + 133369743 at System.Reflection.MonoCMethod.Invoke (System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:545 at System.Activator.CreateInstance (System.Type,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo,object[]) [0x00174] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:299 at System.Activator.CreateInstance (System.Type,object[],object[]) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:234 at System.Activator.CreateInstance (System.Type,object[]) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:229 at Cirrious.MvvmCross.Application.MvxDefaultViewModelLocator.TryLoad (System.Type,System.Collections.Generic.IDictionary2<string, string>,Cirrious.MvvmCross.Interfaces.ViewModels.IMvxViewModel&) <IL 0x00043, 0x000d8> at Cirrious.MvvmCross.Application.MvxViewModelLoader.LoadViewModel (Cirrious.MvvmCross.Views.MvxShowViewModelRequest) <IL 0x0005b, 0x000a2> at Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods.LoadViewModel<TViewModel> (Cirrious.MvvmCross.Touch.Interfaces.IMvxTouchView1) at Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods/c__AnonStorey01.<>m__0 () <IL 0x00006, 0x00034> at Cirrious.MvvmCross.ExtensionMethods.MvxViewExtensionMethods.OnViewCreate<TViewModel> (Cirrious.MvvmCross.Interfaces.Views.IMvxView1,System.Func1<TViewModel>) <IL 0x00012, 0x00045> at Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods.OnViewCreate<TViewModel> (Cirrious.MvvmCross.Touch.Interfaces.IMvxTouchView1) at Cirrious.MvvmCross.Touch.Views.MvxTouchViewController`1.ViewDidLoad () at MyApp.UI.Touch.MainMenuViewController.ViewDidLoad () [0x00000] in /Users/franklyn/Documents/Programming/MyApp/MyApp.UI.Touch/Views/MainMenuViewController.cs:34

Edit - the rest of the exception trace:

at (wrapper runtime-invoke) object.runtime_invoke_void_this_ (object,intptr,intptr,intptr) 18 MyApp 0x00008732 mono_jit_runtime_invoke + 722 19 MyApp 0x0014f39e mono_runtime_invoke + 126 20 MyApp 0x001e6296 monotouch_trampoline + 3686 21 UIKit 0x00a4b817 -[UIViewController loadViewIfRequired] + 536 22 UIKit 0x00a4b882 -[UIViewController view] + 33 23 UIKit 0x00a4bb2a -[UIViewController contentScrollView] + 36 24 UIKit 0x00a62ef5 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 36 25 UIKit 0x00a62fdb -[UINavigationController _layoutViewController:] + 43 26 UIKit 0x00a63286 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 254 27 UIKit 0x00a63381 -[UINavigationController _startTransition:fromViewController:toViewController:] + 72 28 UIKit 0x00a63eab -[UINavigationController _startDeferredTransitionIfNeeded:] + 386 29 UIKit 0x00a63fc9 -[UINavigationController _startDeferredTransitionIfNeeded] + 41 30 UIKit 0x00a64055 -[UINavigationController viewWillLayoutSubviews] + 33 31 UIKit 0x00b693ab -[UILayoutContainerView layoutSubviews] + 233 32 UIKit 0x009ba92d -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 279 33 libobjc.A.dylib 0x022086b0 -[NSObject performSelector:withObject:] + 70 34 QuartzCore 0x01952fc0 -[CALayer layoutSublayers] + 240 35 QuartzCore 0x0194733c _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 468 36 QuartzCore 0x01952eaf -[CALayer layoutIfNeeded] + 166 37 UIKit 0x00a598cd -[UIViewController window:setupWithInterfaceOrientation:] + 242 38 UIKit 0x009a21a6 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 5346 39 UIKit 0x009a0cbf -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 82 40 UIKit 0x009a0bd9 -[UIWindow _setRotatableViewOrientation:duration:force:] + 89 41 UIKit 0x0099fe34 __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke_0 + 224 42 UIKit 0x0099fc6e -[UIWindow _updateToInterfaceOrientation:duration:force:] + 209 43 UIKit 0x009a0a29 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 853 44 UIKit 0x009a3922 -[UIWindow setDelegate:] + 351 45 UIKit 0x00a4dfec -[UIViewController _tryBecomeRootViewControllerInWindow:] + 164 46 UIKit 0x0099abc4 -[UIWindow addRootViewControllerViewIfPossible] + 481 47 UIKit 0x0099adbf -[UIWindow _setHidden:forced:] + 368 48 UIKit 0x0099af55 -[UIWindow _orderFrontWithoutMakingKey] + 49 49 UIKit 0x009a3f67 -[UIWindow makeKeyAndVisible] + 65 at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend (intptr,intptr) at MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x00008] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIWindow.g.cs:126 at MyApp.UI.Touch.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication,MonoTouch.Foundation.NSDictionary) [0x0003b] in /Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/OtherClasses/AppDelegate.cs:46 at (wrapper runtime-invoke) .runtime_invoke_bool__this_object_object (object,intptr,intptr,intptr) 54 MyApp 0x00008732 mono_jit_runtime_invoke + 722 55 MyApp 0x0014f39e mono_runtime_invoke + 126 56 MyApp 0x001e6296 monotouch_trampoline + 3686 57 UIKit 0x009677b7 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 266 58 UIKit 0x00967da7 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1248 59 UIKit 0x00968fab -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 805 60 UIKit 0x0097a315 -[UIApplication handleEvent:withNewEvent:] + 1022 61 UIKit 0x0097b24b -[UIApplication sendEvent:] + 85 62 UIKit 0x0096ccf8 _UIApplicationHandleEvent + 9874 63 GraphicsServices 0x02c98df9 _PurpleEventCallback + 339 64 GraphicsServices 0x02c98ad0 PurpleEventCallback + 46 65 CoreFoundation 0x01f34bf5 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 53 66 CoreFoundation 0x01f34962 __CFRunLoopDoSource1 + 146 67 CoreFoundation 0x01f65bb6 __CFRunLoopRun + 2118 68 CoreFoundation 0x01f64f44 CFRunLoopRunSpecific + 276 69 CoreFoundation 0x01f64e1b CFRunLoopRunInMode + 123 70 UIKit 0x009687da -[UIApplication _run] + 774 71 UIKit 0x0096a65c UIApplicationMain + 1211 at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38 at MyApp.UI.Touch.Application.Main (string[]) [0x00000] in /Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/OtherClasses/Main.cs:17 at (wrapper runtime-invoke) .runtime_invoke_void_object (object,intptr,intptr,intptr) 76 MyApp 0x00008732 mono_jit_runtime_invoke + 722 77 MyApp 0x0014f39e mono_runtime_invoke + 126 78 MyApp 0x001534c4 mono_runtime_exec_main + 420 79 MyApp 0x00157ff5 mono_runtime_run_main + 725 80 MyApp 0x000651a5 mono_jit_exec + 149 81 MyApp 0x001db7b5 main + 2005 82 MyApp 0x000021f5 start + 53

2013-03-25 08:12:00.009 MyApp[7906:12203] Unhandled managed exception: Exception has been thrown by the target of an invocation. (System.Reflection.TargetInvocationException) at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0011f] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:536 at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:545 at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00174] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:299 at System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:234 at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:229 at Cirrious.MvvmCross.Application.MvxDefaultViewModelLocator.TryLoad (System.Type viewModelType, IDictionary2 parameterValueLookup, IMvxViewModel& model) [0x00000] in <filename unknown>:0 at Cirrious.MvvmCross.Application.MvxViewModelLoader.LoadViewModel (Cirrious.MvvmCross.Views.MvxShowViewModelRequest request) [0x00000] in <filename unknown>:0 at Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods.LoadViewModel[MainMenuViewModel] (IMvxTouchView1 touchView) [0x00000] in :0 at Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods+c__AnonStorey01[MyApp.Core.ViewModels.MainMenuViewModel].<>m__0 () [0x00000] in <filename unknown>:0 at Cirrious.MvvmCross.ExtensionMethods.MvxViewExtensionMethods.OnViewCreate[MainMenuViewModel] (IMvxView1 view, System.Func1 viewModelLoader) [0x00000] in <filename unknown>:0 at Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods.OnViewCreate[MainMenuViewModel] (IMvxTouchView1 touchView) [0x00000] in :0 at Cirrious.MvvmCross.Touch.Views.MvxTouchViewController`1[MyApp.Core.ViewModels.MainMenuViewModel].ViewDidLoad () [0x00000] in :0 at MyApp.UI.Touch.MainMenuViewController.ViewDidLoad () [0x00000] in /Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/Views/MainMenuViewController.cs:34 at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSend (intptr,intptr) at MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x00008] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIWindow.g.cs:126 at MyApp.UI.Touch.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x0003b] in /Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/OtherClasses/AppDelegate.cs:46 at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) 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 at MyApp.UI.Touch.Application.Main (System.String[] args) [0x00000] in /Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/OtherClasses/Main.cs:17 Stacktrace:

Native stacktrace:

0   MyApp                      0x0007bf6c mono_handle_native_sigsegv + 284
1   MyApp                      0x000c01ad sigabrt_signal_handler + 109
2   libsystem_c.dylib                   0x9a5da59b _sigtramp + 43
3   ???                                 0xffffffff 0x0 + 4294967295
4   libsystem_sim_c.dylib               0x0297457b abort + 140
5   MyApp                      0x001ed17b monotouch_unhandled_exception_handler + 283
6   MyApp                      0x00077dbc mono_invoke_unhandled_exception_hook + 140
7   MyApp                      0x0007bbda mono_handle_exception_internal + 4154
8   MyApp                      0x0007bd2f mono_handle_exception + 47
9   MyApp                      0x000bce22 mono_x86_throw_exception + 306
10  ???                                 0x07f30f8f 0x0 + 133369743
11  ???                                 0x0bad1a5d 0x0 + 195893853
12  ???                                 0x0bad13dd 0x0 + 195892189
13  ???                                 0x0bad1164 0x0 + 195891556
14  ???                                 0x0bad112c 0x0 + 195891500
15  ???                                 0x11b0a360 0x0 + 296788832
16  ???                                 0x11b09fca 0x0 + 296787914
17  ???                                 0x11b09de2 0x0 + 296787426
18  ???                                 0x11b09cf4 0x0 + 296787188
19  ???                                 0x11b09c65 0x0 + 296787045
20  ???                                 0x11b09b60 0x0 + 296786784
21  ???                                 0x11b09a5c 0x0 + 296786524
22  ???                                 0x11b099c4 0x0 + 296786372
23  ???                                 0x07fe2059 0x0 + 134094937
24  MyApp                      0x00008732 mono_jit_runtime_invoke + 722
25  MyApp                      0x0014f39e mono_runtime_invoke + 126
26  MyApp                      0x001e6296 monotouch_trampoline + 3686
27  UIKit                               0x00a4b817 -[UIViewController loadViewIfRequired] + 536
28  UIKit                               0x00a4b882 -[UIViewController view] + 33
29  UIKit                               0x00a4bb2a -[UIViewController contentScrollView] + 36
30  UIKit                               0x00a62ef5 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 36
31  UIKit                               0x00a62fdb -[UINavigationController _layoutViewController:] + 43
32  UIKit                               0x00a63286 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 254
33  UIKit                               0x00a63381 -[UINavigationController _startTransition:fromViewController:toViewController:] + 72
34  UIKit                               0x00a63eab -[UINavigationController _startDeferredTransitionIfNeeded:] + 386
35  UIKit                               0x00a63fc9 -[UINavigationController _startDeferredTransitionIfNeeded] + 41
36  UIKit                               0x00a64055 -[UINavigationController __viewWillLayoutSubviews] + 33
37  UIKit                               0x00b693ab -[UILayoutContainerView layoutSubviews] + 233
38  UIKit                               0x009ba92d -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 279
39  libobjc.A.dylib                     0x022086b0 -[NSObject performSelector:withObject:] + 70
40  QuartzCore                          0x01952fc0 -[CALayer layoutSublayers] + 240
41  QuartzCore                          0x0194733c _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 468
42  QuartzCore                          0x01952eaf -[CALayer layoutIfNeeded] + 166
43  UIKit                               0x00a598cd -[UIViewController window:setupWithInterfaceOrientation:] + 242
44  UIKit                               0x009a21a6 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 5346
45  UIKit                               0x009a0cbf -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 82
46  UIKit                               0x009a0bd9 -[UIWindow _setRotatableViewOrientation:duration:force:] + 89
47  UIKit                               0x0099fe34 __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke_0 + 224
48  UIKit                               0x0099fc6e -[UIWindow _updateToInterfaceOrientation:duration:force:] + 209
49  UIKit                               0x009a0a29 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 853
50  UIKit                               0x009a3922 -[UIWindow setDelegate:] + 351
51  UIKit                               0x00a4dfec -[UIViewController _tryBecomeRootViewControllerInWindow:] + 164
52  UIKit                               0x0099abc4 -[UIWindow addRootViewControllerViewIfPossible] + 481
53  UIKit                               0x0099adbf -[UIWindow _setHidden:forced:] + 368
54  UIKit                               0x0099af55 -[UIWindow _orderFrontWithoutMakingKey] + 49
55  UIKit                               0x009a3f67 -[UIWindow makeKeyAndVisible] + 65
56  ???                                 0x11aee564 0x0 + 296674660
57  ???                                 0x11b099a8 0x0 + 296786344
58  ???                                 0x0bad24ee 0x0 + 195896558
59  ???                                 0x0bad25df 0x0 + 195896799
60  MyApp                      0x00008732 mono_jit_runtime_invoke + 722
61  MyApp                      0x0014f39e mono_runtime_invoke + 126
62  MyApp                      0x001e6296 monotouch_trampoline + 3686
63  UIKit                               0x009677b7 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 266
64  UIKit                               0x00967da7 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1248
65  UIKit                               0x00968fab -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 805
66  UIKit                               0x0097a315 -[UIApplication handleEvent:withNewEvent:] + 1022
67  UIKit                               0x0097b24b -[UIApplication sendEvent:] + 85
68  UIKit                               0x0096ccf8 _UIApplicationHandleEvent + 9874
69  GraphicsServices                    0x02c98df9 _PurpleEventCallback + 339
70  GraphicsServices                    0x02c98ad0 PurpleEventCallback + 46
71  CoreFoundation                      0x01f34bf5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
72  CoreFoundation                      0x01f34962 __CFRunLoopDoSource1 + 146
73  CoreFoundation                      0x01f65bb6 __CFRunLoopRun + 2118
74  CoreFoundation                      0x01f64f44 CFRunLoopRunSpecific + 276
75  CoreFoundation                      0x01f64e1b CFRunLoopRunInMode + 123
76  UIKit                               0x009687da -[UIApplication _run] + 774
77  UIKit                               0x0096a65c UIApplicationMain + 1211
78  ???                                 0x0bacf84c 0x0 + 195885132
79  ???                                 0x0bace218 0x0 + 195879448
80  ???                                 0x0bacdfb0 0x0 + 195878832
81  ???                                 0x0bace03f 0x0 + 195878975
82  MyApp                      0x00008732 mono_jit_runtime_invoke + 722
83  MyApp                      0x0014f39e mono_runtime_invoke + 126
84  MyApp                      0x001534c4 mono_runtime_exec_main + 420
85  MyApp                      0x00157ff5 mono_runtime_run_main + 725
86  MyApp                      0x000651a5 mono_jit_exec + 149
87  MyApp                      0x001db7b5 main + 2005
88  MyApp                      0x000021f5 start + 53

================================================================= 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.

Thanks for any help.

1

1 Answers

0
votes

Without the inner exception it's hard to know what has gone wrong - sorry.

I'd guess that there is some problem in initializing the geowatcher - either because:

  • the plugin isn't registered
  • you call this line before you've called Cirrious.MvvmCross.Plugins.Location.PluginLoader.Instance.EnsureLoaded()
  • or because of some 'app specific reason'.

The tutorial app uses the location plugin in: https://github.com/slodge/MvvmCross/tree/vnext/Sample%20-%20Tutorial/Tutorial/Tutorial.UI.Touch

Does the tutorial work for you? If it does, then you'll maybe need to look at comparing the two.

If the crash persists for you, then maybe: - post the inner exception if you can? - or post a small repo which demos the problem - I'd certainly need more code than I can see in this 2 line snippet.


Sorry for the lack of documentation. I am making a huge effort right now to create proper documents and tutorials for the new v3 released - but this is all self-funded!