TabbedPage NullPointerException

RaphaelSchindlerRaphaelSchindler USMember ✭✭✭
edited March 2015 in Xamarin.Forms

Hey,
I have a problem with a Modal Page. In my Application the user can edit one of his contacts. For that I Push a Modal Page where he can edit the information and then save it. The Modal Page is Pushed from a TabbedPage. Nothing really complex here just a PushModalAsync() and PopModalAsync().

Here starts the problem. When I Pop the Modal Page the OnAppearing() is not fired on the Detail in the TabbedPage. Which is bad since the Detail Page is not updated with the new values. I tried to get around this with MessagingCenter and on the Subcribed Event I call OnAppearing() but then I get Unhandled Exception and GC goes on rampage mode.
@TheRealJasonSmith Is this a problem with the MonoRuntime?

Maybe someone has an idea and could help me with that problem.

This is the Stacktrace:

An unhandled exception occured.
03-16 16:39:27.940 D/Mono    (  595): DllImport attempting to load: '/system/lib/liblog.so'.
03-16 16:39:27.940 D/Mono    (  595): DllImport loaded library '/system/lib/liblog.so'.
03-16 16:39:27.941 D/Mono    (  595): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
03-16 16:39:27.942 D/Mono    (  595): Searching for '__android_log_print'.
03-16 16:39:27.944 D/Mono    (  595): Probing '__android_log_print'.
03-16 16:39:27.945 D/Mono    (  595): Found as '__android_log_print'.
03-16 16:39:27.950 I/MonoDroid(  595): UNHANDLED EXCEPTION:
03-16 16:39:28.001 I/MonoDroid(  595): Java.Lang.NullPointerException: Exception of type 'Java.Lang.NullPointerException' was thrown.
03-16 16:39:28.002 I/MonoDroid(  595):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
03-16 16:39:28.002 I/MonoDroid(  595):   at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00084] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:896 
03-16 16:39:28.002 I/MonoDroid(  595):   at Android.Runtime.JNIEnv.InvokeConstructor (IntPtr instance, System.String jniCtorSignature, Android.Runtime.JValue[] constructorParameters) [0x0003b] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:321 
03-16 16:39:28.003 I/MonoDroid(  595):   at Android.Runtime.JNIEnv.FinishCreateInstance (IntPtr instance, System.String jniCtorSignature, Android.Runtime.JValue[] constructorParameters) [0x0000b] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:310 
03-16 16:39:28.006 I/MonoDroid(  595)03-16 16:39:28.003 I/MonoDroid(  595):   at Xamarin.Forms.Platform.Android.FormsViewGroup..ctor (Android.Content.Context p0) [0x00000] in <filename unknown>:0 
03-16 16:39:28.004 I/MonoDroid(  595):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[Xamarin.Forms.View]..ctor () [0x00000] in <filename unknown>:0 
03-16 16:39:28.004 I/MonoDroid(  595):   at Xamarin.Forms.Platform.Android.RendererFactory+DefaultRenderer..ctor () [0x00000] in <filename unknown>:0 
03-16 16:39:28.004 I/MonoDroid(  595):   at Xamarin.Forms.Platform.Android.RendererFactory.GetRenderer (Xamarin.Forms.VisualElement view) [0x00000] in <filename unknown>:0 
03-16 16:39:28.004 I/MonoDroid(  595):   at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, Boolean sameChildren) [0x00000] in <filename unknown>:0 
03-16 16:39:28.005 I/MonoDroid(  595):   at Xamarin.Forms.Platform.Android.VisualElementPackager.OnChildAdded (System.Object sender, Xamarin.Forms.ElementEventArgs e) [0x00000] in <filename unknown>:0 
03-16 16:39:28.005 I/MonoDroid(  595):   at Xamarin.Forms.Element.OnChildAdded (Xamarin.Forms.Element child) [0x00000] in <filename unknown>:0 
03-16 16:39:28.005 I/MonoDroid(  595):   at Xamarin.Forms.Page.OnInternalAdded (Xamarin.Forms.VisualElement view) [0x00000] in <filename unknown>:0 
03-16 16:39:28.006 I/MonoDroid(  595):   at Xamarin.Forms.Page.InternalChildrenOnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in <filename unknown>:0 
03-16 16:39:28.006 I/MonoDroid(  595):   at System.Collections.ObjectModel.ObservableCollection`1[Xamarin.Forms.Element].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in <filename unknown>:0 
03-16 16:39:28.006 I/MonoDroid(  595):   at System.Collections.ObjectModel.ObservableCollection`1[Xamarin.Forms.Element].InsertItem (Int32 index, Xamarin.Forms.Element item) [0x00000] in <filename unknown>:0 
03-16 16:39:28.007 I/MonoDroid(  595):   at System.Collections.ObjectModel.Collection`1[Xamarin.Forms.Element].Add (Xamarin.Forms.Element item) [0x00000] in <filename unknown>:0 
03-16 16:39:28.007 I/MonoDroid(  595):   at Xamarin.Forms.ContentPage.set_Content (Xamarin.Forms.View value) [0x00000] in <filename unknown>:0 
03-16 16:39:28.008 I/MonoDroid(  595):   at mCRM.Views.Contact.ContactDetailView.InitView () [0x00060] in c:\Users\Schindler\Documents\Visual Studio 2012\Projects\mCRM\mCRM\mCRM\Views\Contact\ContactDetailView.cs:64 
03-16 16:39:28.008 I/MonoDroid(  595):   at mCRM.Views.Contact.ContactDetailView.OnAppearing () [0x00001] in c:\Users\Schindler\Documents\Visual Studio 2012\Projects\mCRM\mCRM\mCRM\Views\Contact\ContactDetailView.cs:50 
03-16 16:39:28.009 I/MonoDroid(  595):   at mCRM.Views.Contact.ContactDetailView.<.ctor>b__0 (mCRM.Views.Contact.ContactCeView sender) [0x00001] in c:\Users\Schindler\Documents\Visual Studio 2012\Projects\mCRM\mCRM\mCRM\Views\Contact\ContactDetailView.cs:41 
03-16 16:39:28.009 I/MonoDroid(  595):   at Xamarin.Forms.MessagingCenter+<>c__DisplayClass4`1[mCRM.Views.Contact.ContactCeView].<Subscribe>b__3 (System.Object sender, System.Object args) [0x00000] in <filename unknown>:0 
03-16 16:39:28.010 I/MonoDroid(  595):   at Xamarin.Forms.MessagingCenter.InnerSend (System.String message, System.Type senderType, System.Type argType, System.Object sender, System.Object args) [0x00000] in <filename unknown>:0 
03-16 16:39:28.010 I/MonoDroid(  595):   at Xamarin.Forms.MessagingCenter.Send[ContactCeView] (mCRM.Views.Contact.ContactCeView sender, System.String message) [0x00000] in <filename unknown>:0 
03-16 16:39:28.010 I/MonoDroid(  595):   at mCRM.Views.Contact.ContactCeView+<SaveContact>d__a.MoveNext () [0x003e9] in c:\Users\Schindler\Documents\Visual Studio 2012\Projects\mCRM\mCRM\mCRM\Views\Contact\ContactCeView.cs:193 
03-16 16:39:28.011 I/MonoDroid(  595): --- End of stack trace from previous location where exception was thrown ---
03-16 16:39:28.011 I/MonoDroid(  595):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
03-16 16:39:28.011 I/MonoDroid(  595):   at System.Runtime.CompilerServices.TaskAwaiter`1[System.Boolean].GetResult () [0x00000] in <filename unknown>:0 
03-16 16:39:28.012 I/MonoDroid(  595):   at mCRM.Views.Contact.ContactCeView+<>c__DisplayClass34+<<InitView>b__32>d__38.MoveNext () [0x0001b] in c:\Users\Schindler\Documents\Visual Studio 2012\Projects\mCRM\mCRM\mCRM\Views\Contact\ContactCeView.cs:419 
03-16 16:39:28.012 I/MonoDroid(  595):   --- End of managed exception stack trace ---
03-16 16:39:28.013 I/MonoDroid(  595): java.lang.NullPointerException
03-16 16:39:28.013 I/MonoDroid(  595):  at android.view.ViewConfiguration.get(ViewConfiguration.java:318)
03-16 16:39:28.013 I/MonoDroid(  595):  at android.view.View.<init>(View.java:3236)
03-16 16:39:28.014 I/MonoDroid(  595):  at android.view.ViewGroup.<init>(ViewGroup.java:420)
03-16 16:39:28.014 I/MonoDroid(  595):  at com.xamarin.forms.platform.android.FormsViewGroup.<init>(FormsViewGroup.java:12)
03-16 16:39:28.015 I/MonoDroid(  595):  at xamarin.forms.platform.android.VisualElementRenderer_1.<init>(VisualElementRenderer_1.java:38)
03-16 16:39:28.015 I/MonoDroid(  595):  at xamarin.forms.platform.android.RendererFactory_DefaultRenderer.<init>(RendererFactory_DefaultRenderer.java:35)
03-16 16:39:28.016 I/MonoDroid(  595):  at toasts.forms.plugin.droid.Manager.n_handleMessage(Native Method)
03-16 16:39:28.016 I/MonoDroid(  595):  at toasts.forms.plugin.droid.Manager.handleMessage(Manager.java:52)
03-16 16:39:28.017 I/MonoDroid(  595):  at android.os.Handler.dispatchMessage(Handler.java:99)
03-16 16:39:28.017 I/MonoDroid(  595):  at android.os.Looper.loop(Looper.java:137)
03-16 16:39:28.018 I/MonoDroid(  595):  at android.app.ActivityThread.main(ActivityThread.java:5041)
03-16 16:39:28.018 I/MonoDroid(  595):  at java.lang.reflect.Method.invokeNative(Native Method)
03-16 16:39:28.018 I/MonoDroid(  595):  at java.lang.reflect.Method.invoke(Method.java:511)
03-16 16:39:28.019 I/MonoDroid(  595):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-16 16:39:28.019 I/MonoDroid(  595):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-16 16:39:28.020 I/MonoDroid(  595):  at dalvik.system.NativeStart.main(Native Method)
03-16 16:39:28.707 D/dalvikvm(  595): GC_EXPLICIT freed 633K, 9% free 7289K/7988K, paused 2ms+4ms, total 49ms
03-16 16:39:28.720 D/Mono    (  595): GC_OLD_BRIDGE num-objects 732 num_hash_entries 16858 sccs size 9127 init 0.00ms df1 54.55ms sort 11.55ms dfs2 94.02ms setup-cb 3.48ms free-data 49.84ms links 29571/29571/717160/95 dfs passes 47161/38698
03-16 16:39:28.720 D/Mono    (  595): GC_MINOR: (Nursery full) pause 81.58ms, total 81.83ms, bridge 229.14ms promoted 720K major 2336K los 3137K
03-16 16:39:28.990 D/dalvikvm(  595): GC_EXPLICIT freed 177K, 10% free 7239K/7988K, paused 2ms+4ms, total 43ms
03-16 16:39:28.991 D/Mono    (  595): GC_OLD_BRIDGE num-objects 1 num_hash_entries 1 sccs size 1 init 0.00ms df1 0.43ms sort 0.00ms dfs2 0.07ms setup-cb 0.01ms free-data 0.06ms links 0/0/0/0 dfs passes 2/1
03-16 16:39:28.992 D/Mono    (  595): GC_MINOR: (Nursery full) pause 4.73ms, total 4.93ms, bridge 44.96ms promoted 16K major 2352K los 5004K
03-16 16:39:29.198 D/Mono    (  595): GC_OLD_BRIDGE num-objects 1 num_hash_entries 1 sccs size 1 init 0.00ms df1 0.43ms sort 0.00ms dfs2 0.07ms setup-cb 0.01ms free-data 0.06ms links 0/0/0/0 dfs passes 0/0
03-16 16:39:29.198 D/Mono    (  595): GC_MINOR: (Nursery full) pause 3.84ms, total 4.04ms, bridge 0.20ms promoted 16K major 2368K los 9212K
03-16 16:39:29.435 D/dalvikvm(  595): GC_EXPLICIT freed 369K, 12% free 7095K/7988K, paused 2ms+3ms, total 37ms
03-16 16:39:29.444 D/Mono    (  595): GC_OLD_BRIDGE num-objects 549 num_hash_entries 609 sccs size 605 init 0.00ms df1 2.20ms sort 0.22ms dfs2 1.59ms setup-cb 0.43ms free-data 0.40ms links 110/110/107/3 dfs passes 1268/715
03-16 16:39:29.444 D/Mono    (  595): GC_MAJOR: (LOS overflow) pause 24.99ms, total 25.21ms, bridge 55.24ms major 2352K/2368K los 660K/14576K
03-16 16:39:29.674 D/Mono    (  595): GC_OLD_BRIDGE num-objects 549 num_hash_entries 609 sccs size 605 init 0.00ms df1 2.20ms sort 0.22ms dfs2 1.59ms setup-cb 0.43ms free-data 0.40ms links 0/0/0/0 dfs passes 0/0
03-16 16:39:29.674 D/Mono    (  595): GC_MINOR: (Nursery full) pause 4.06ms, total 4.26ms, bridge 0.20ms promoted 0K major 2352K los 5570K
03-16 16:39:29.879 D/Mono    (  595): GC_OLD_BRIDGE num-objects 549 num_hash_entries 609 sccs size 605 init 0.00ms df1 2.20ms sort 0.22ms dfs2 1.59ms setup-cb 0.43ms free-data 0.40ms links 0/0/0/0 dfs passes 0/0

Posts

  • RaphaelSchindlerRaphaelSchindler USMember ✭✭✭
    edited March 2015

    I tested this some more and came to the result that this is an Android problem. On iOS it's working like it should.

    I tested with:

    iPhone Simulator iPhone 6 iOS 8.2 <- Success
    iPhone 4S iOS 7.1 <- Success
    iPad2 iOS 8.1 <- Success

    Gigaset Tablet Android 4.2.2 <- Fails
    Galaxy Note 2 Android 5.0.2 <- Fails

    I'm making an example project and gonna open a bug in bugzilla.
    It would be great if someone from the Xamarin Team could look into this!

  • RaphaelSchindlerRaphaelSchindler USMember ✭✭✭

    I filled a bug report with an example app here: https://bugzilla.xamarin.com/show_bug.cgi?id=28191

Sign In or Register to comment.