This error popped up in the forums some times, but a real solution is not presented. Or did I overlook that?
What happens by my code that a contentview.content is replaced with a contentview (holding a scrollview), that was earlier assigned to this content (like choose next tab and then previous tab). The tab content is not regenerated, just reassigned.
What seem to happen that an OnCollectionChanged on the scrollview is fired due to this assignment, and there the native element is not updated properly.
Anybody did find a solution in the past?
Java.Lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
01-26 12:02:03.875 D/Mono ( 6253): DllImport attempting to load: '/system/lib/liblog.so'.
01-26 12:02:03.875 D/Mono ( 6253): DllImport loaded library '/system/lib/liblog.so'.
01-26 12:02:03.875 D/Mono ( 6253): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
01-26 12:02:03.875 D/Mono ( 6253): Searching for '__android_log_print'.
01-26 12:02:03.880 D/Mono ( 6253): Probing '__android_log_print'.
01-26 12:02:03.880 D/Mono ( 6253): Found as '__android_log_print'.
01-26 12:02:03.895 I/MonoDroid( 6253): UNHANDLED EXCEPTION:
01-26 12:02:03.900 I/MonoDroid( 6253): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <IL 0x00011, 0x00068>
01-26 12:02:03.900 I/MonoDroid( 6253): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) [0x00084] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:896
01-26 12:02:03.900 I/MonoDroid( 6253): at Android.Views.ViewGroup.AddView (Android.Views.View) [0x00070] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/platforms/android-17/src/generated/Android.Views.ViewGroup.cs:1663
01-26 12:02:03.905 I/MonoDroid( 6253): at System.Collections.ObjectModel.ObservableCollection`1<Xamarin.Forms.Element>.OnCollectionChanged (System.Co <IL 0x00054, 0x00203>
01-26 12:02:03.900 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.ScrollViewRenderer.LoadContent () <IL 0x00011, 0x00083>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.ScrollViewRenderer.SetElement (Xamarin.Forms.VisualElement) <IL 0x000ab, 0x0047b>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.RendererFactory.GetRenderer (Xamarin.Forms.VisualElement) <IL 0x00022, 0x0013f>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement,Xamarin.Forms.Platform.Android.IVisualElementRenderer,Xamarin.Forms.Platform.Android.RendererPool,bool) <IL 0x00011, 0x000ff>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement,Xamarin.Forms.VisualElement) <IL 0x00116, 0x00827>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () <IL 0x0000d, 0x0008b>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager) <0x00083>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.SetElement (Xamarin.Forms.View) <0x006a3>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement) <0x0012b>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.RendererFactory.GetRenderer (Xamarin.Forms.VisualElement) <IL 0x00022, 0x0013f>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement,Xamarin.Forms.Platform.Android.IVisualElementRenderer,Xamarin.Forms.Platform.Android.RendererPool,bool) <IL 0x00011, 0x000ff>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement,Xamarin.Forms.VisualElement) <IL 0x00116, 0x00827>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () <IL 0x0000d, 0x0008b>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager) <0x00083>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.SetElement (Xamarin.Forms.View) <0x006a3>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement) <0x0012b>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.RendererFactory.GetRenderer (Xamarin.Forms.VisualElement) <IL 0x00022, 0x0013f>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement,Xamarin.Forms.Platform.Android.IVisualElementRenderer,Xamarin.Forms.Platform.Android.RendererPool,bool) <IL 0x00011, 0x000ff>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.VisualElementPackager.OnChildAdded (object,Xamarin.Forms.ElementEventArgs) <IL 0x00014, 0x000eb>
An unhandled exception occured.
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Element.OnChildAdded (Xamarin.Forms.Element) <IL 0x00037, 0x00187>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Layout.OnInternalAdded (Xamarin.Forms.View) <IL 0x00014, 0x000ef>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Layout.InternalChildrenOnCollectionChanged (object,System.Collections.Specialized.NotifyCollectionChangedEventArgs) <IL 0x0008a, 0x0068b>
01-26 12:02:03.905 I/MonoDroid( 6253): at System.Collections.ObjectModel.ObservableCollection`1<Xamarin.Forms.Element>.OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs) <0x000f7>
01-26 12:02:03.905 I/MonoDroid( 6253): at System.Collections.ObjectModel.ObservableCollection`1<Xamarin.Forms.Element>.InsertItem (int,Xamarin.Forms.Element) <0x000d3>
01-26 12:02:03.905 I/MonoDroid( 6253): at System.Collections.ObjectModel.Collection`1<Xamarin.Forms.Element>.Add (Xamarin.Forms.Element) <0x000c3>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.ContentView.set_Content (Xamarin.Forms.View) <IL 0x0004a, 0x0019f>
01-26 12:02:03.905 I/MonoDroid( 6253): at <myapp>.Controllers.TabView.OnTabPropertyChanged (object,System.ComponentModel.PropertyChangedEventArgs) [0x00064] in z:\development\<myapp>\<myapp>\<myapp>\Controllers\TabView.cs:290
01-26 12:02:03.905 I/MonoDroid( 6253): at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00067>
01-26 12:02:03.905 I/MonoDroid( 6253): at <myapp>.Controllers.Tab.RaisePropertyChanged (string) [0x0000e] in z:\development\<myapp>\<myapp>\<myapp>\Controllers\ITabView.cs:127
01-26 12:02:03.905 I/MonoDroid( 6253): at <myapp>.Controllers.Tab.set_Selected (bool) [0x0001a] in z:\development\<myapp>\<myapp>\<myapp>\Controllers\ITabView.cs:103
01-26 12:02:03.905 I/MonoDroid( 6253): at <myapp>.Controllers.Tab.<get_TabImage>b__2 () [0x0000b] in z:\development\<myapp>\<myapp>\<myapp>\Controllers\ITabView.cs:147
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Command/<>c__DisplayClass2.<.ctor>b__0 (object) <IL 0x00006, 0x00057>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Command.Execute (object) <IL 0x00007, 0x0005b>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.TapGestureRecognizer.SendTapped (Xamarin.Forms.View) <IL 0x0001f, 0x0014b>
01-26 12:02:03.905 I/MonoDroid( 6253): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.Image>.Android.Views.View.IOnClickListener.OnClick (Android.Views.View) <0x0031f>
01-26 12:02:03.910 I/MonoDroid( 6253): at Android.Views.View/IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/platforms/android-17/src/generated/Android.Views.View.cs:1791
01-26 12:02:03.910 I/MonoDroid( 6253): at (wrapper dynamic-method) object.01837072-f122-44f3-a0f7-d8608303452b (intptr,intptr,intptr) <IL 0x00017, 0x00043>
01-26 12:02:03.910 I/MonoDroid( 6253): --- End of managed exception stack trace ---
01-26 12:02:03.910 I/MonoDroid( 6253): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
01-26 12:02:03.910 I/MonoDroid( 6253): at android.view.ViewGroup.addViewInner(ViewGroup.java:3672)
01-26 12:02:03.910 I/MonoDroid( 6253): at android.view.ViewGroup.addView(ViewGroup.java:3543)
01-26 12:02:03.910 I/MonoDroid( 6253): at android.view.ViewGroup.addView(ViewGroup.java:3488)
01-26 12:02:03.910 I/MonoDroid( 6253): at android.view.ViewGroup.addView(ViewGroup.java:3464)
01-26 12:02:03.910 I/MonoDroid( 6253): at xamarin.forms.platform.android.VisualElementRenderer_1.n_onClick(Native Method)
01-26 12:02:03.910 I/MonoDroid( 6253): at xamarin.forms.platform.android.VisualElementRenderer_1.onClick(VisualElementRenderer_1.java:54)
01-26 12:02:03.910 I/MonoDroid( 6253): at android.view.View.performClick(View.java:4232)
01-26 12:02:03.910 I/MonoDroid( 6253): at android.view.View$PerformClick.run(View.java:17318)
01-26 12:02:03.910 I/MonoDroid( 6253): at android.os.Handler.handleCallback(Handler.java:615)
01-26 12:02:03.910 I/MonoDroid( 6253): at android.os.Handler.dispatchMessage(Handler.java:92)
01-26 12:02:03.910 I/MonoDroid( 6253): at android.os.Looper.loop(Looper.java:137)
01-26 12:02:03.910 I/MonoDroid( 6253): at android.app.ActivityThread.main(ActivityThread.java:4921)
01-26 12:02:03.910 I/MonoDroid( 6253): at java.lang.reflect.Method.invokeNative(Native Method)
01-26 12:02:03.910 I/MonoDroid( 6253): at java.lang.reflect.Method.invoke(Method.java:511)
01-26 12:02:03.910 I/MonoDroid( 6253): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
01-26 12:02:03.910 I/MonoDroid( 6253): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
01-26 12:02:03.910 I/MonoDroid( 6253): at dalvik.system.NativeStart.main(Native Method)