Bug 55614 - Error on Tabbed Page PCL Project
Summary: Error on Tabbed Page PCL Project
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.4
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-04-26 09:41 UTC by Carla Sampaio
Modified: 2017-07-12 22:50 UTC (History)
4 users (show)

Tags: android crash masterdetailpage tabbedpage ac
Is this bug a regression?: ---
Last known good build:

repro project (87.84 KB, application/x-zip-compressed)
2017-04-28 18:36 UTC, Jimmy [MSFT]

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 for Bug 55614 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Carla Sampaio 2017-04-26 09:41:35 UTC
Hi, I have a tabbed page with an home button in the first tab. When I click the Home Tab to go to another page out of the tabbed it shows me this error:

No constructor found for Xamarin.Forms.Platform.Android.AppCompat.FormsFragmentPagerAdapter`1::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership)
Unable to activate instance of type Xamarin.Forms.Platform.Android.AppCompat.FormsFragmentPagerAdapter`1[T] from native handle 0xbe88aebc (key_handle 0x3d7722a7).
  at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x0017d] in <e51048a0fc4547179531680832deab5a>:0 
  at Java.Lang.Object.GetObject (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type type) [0x000b9] in <e51048a0fc4547179531680832deab5a>:0 
  at Java.Lang.Object._GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00017] in <e51048a0fc4547179531680832deab5a>:0 
  at Java.Lang.Object.GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00000] in <e51048a0fc4547179531680832deab5a>:0 
  at Java.Lang.Object.GetObject[T] (System.IntPtr jnienv, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00006] in <e51048a0fc4547179531680832deab5a>:0 
  at Android.Support.V4.View.PagerAdapter.n_GetCount (System.IntPtr jnienv, System.IntPtr native__this) [0x00000] in <5f74b94e38e045928233c54ced659eed>:0 
  at (wrapper dynamic-method) System.Object:e41453e1-5678-4077-9f92-34c29a38ffa7 (intptr,intptr)
Comment 1 Jimmy [MSFT] 2017-04-26 15:33:09 UTC
Thank you for filing this report!

How are you setting the new page? Could you attach a sample project that reproduces the crash? That would really help us look into this issue. 

After providing the requested information, please set the report's status back to NEW. Otherwise we may close this issue after 30 days of no response. Thanks!
Comment 2 Carla Sampaio 2017-04-28 09:55:14 UTC
I have a sample of the bug here: 

Comment 3 Carla Sampaio 2017-04-28 09:55:46 UTC
Setting the status back to new.
Comment 4 Jimmy [MSFT] 2017-04-28 18:36:52 UTC
Created attachment 21890 [details]
repro project

I was able to reproduce this with the project linked to in comment 2. I'm attaching a minimized version to the report.

Complete debug output: https://gist.github.com/jimmgarrido/9d9f093620d988e412966ab2538cce6b

The crash appears to be happening inside OnCurrentPageChanged() in TabbedHome.cs when trying to set App.PaginaPrincipal.Detail. This is happening even when setting it to a ContentPage() so the issue seems to be trying to set the Detail to a different page while the current Detail (TabbedHome in this case) is still doing something.

Another reason I think this is some sort of race condition is that the crash does not occur if I add a small delay before trying to set the Detail. So you could use this as a potential workaround in the meantime. I'm setting the report to CONFIRMED and the team will look further into this.