Bug 35313 - Crash when app was backgrounded for a few hours/days System.NotSupportedExceptionUnable
Summary: Crash when app was backgrounded for a few hours/days System.NotSupportedExcep...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 1.5.1
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-10-27 16:45 UTC by Caan Mee
Modified: 2016-04-13 19:03 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Caan Mee 2015-10-27 16:45:08 UTC
We recently migrated to AppCompat in Xamarin.Forms.

Now we experience a lot of errors across different devices from our users when the app was backgrounded and later resumed (this applies to 4.2,4.4,5.0 etc devices as well as 6.0 devices).

This usually happens only if the app was backgrounded for a longer timespan and then resumed:

System.NotSupportedExceptionUnable to find the default constructor on type Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer. Please provide the missing constructor.
Raw
at Java.Interop.TypeManager.n_Activate (intptr,intptr,intptr,intptr,intptr,intptr) <0x0029c>
at (wrapper dynamic-method) object.69f88349-ae69-47d3-a39b-81796f709b90 (intptr,intptr,intptr,intptr,intptr,intptr) <0x0006b>
Java.Lang.ErrorException of type 'Java.Interop.JavaLocationException' was thrown.
Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown.

  --- End of managed exception stack trace ---
java.lang.Error: Java callstack:
	at mono.android.TypeManager.n_activate(Native Method)
	at mono.android.TypeManager.Activate(TypeManager.java:7)
	at md5eb25e0c6f853c9e5104b7654c9dc6cdf.FragmentContainer.<init>(FragmentContainer.java:24)
	at java.lang.Class.newInstanceImpl(Native Method)
	at java.lang.Class.newInstance(Class.java:1319)
	at android.support.v4.app.Fragment.instantiate(Fragment.java:423)
	at android.support.v4.app.FragmentState.instantiate(Fragment.java:102)
	at android.support.v4.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:1907)
	at android.support.v4.app.FragmentController.restoreAllState(FragmentController.java:135)
	at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:251)
	at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:61)
	at md5b3a82eecd525c0791b0b016a92cda9ac.MainActivity.n_onCreate(Native Method)
	at md5b3a82eecd525c0791b0b016a92cda9ac.MainActivity.onCreate(MainActivity.java:46)
	at android.app.Activity.performCreate(Activity.java:5047)
	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
	at android.app.ActivityThread.access$700(ActivityThread.java:134)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loop(Looper.java:137)
	at android.app.ActivityThread.main(ActivityThread.java:4867)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:511)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
	at dalvik.system.NativeStart.main(Native Method)
Comment 1 apuyana 2015-11-05 11:34:14 UTC
I get the same error on startup (not always, some times)
Xamarin.Forms 1.5.1.6471

System.NotSupportedExceptionUnable to find the default constructor on type Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer. Please provide the missing constructor.

at Java.Interop.TypeManager.n_Activate(intptr, intptr, intptr, intptr, intptr, intptr)
at (wrapper dynamic-method) object.3bff73a7-d80b-46da-bbf3-46ae4f4e677b (intptr,intptr,intptr,intptr,intptr,intptr) <0x00073>

Java.Lang.ErrorException of type 'Java.Interop.JavaLocationException' was thrown.
Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown.

--- End of managed exception stack trace ---

java.lang.Error: Java callstack:
at mono.android.TypeManager.n_activate(Native Method)
at mono.android.TypeManager.Activate(TypeManager.java:7)
at md5eb25e0c6f853c9e5104b7654c9dc6cdf.FragmentContainer.<init>(FragmentContainer.java:24)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1684)
at android.support.v4.app.Fragment.instantiate(Fragment.java:423)
at android.support.v4.app.FragmentState.instantiate(Fragment.java:102)
at android.support.v4.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:1907)
at android.support.v4.app.FragmentController.restoreAllState(FragmentController.java:135)
at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:251)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:61)
at md519be914b4420cc6ce5355b8c56ac9928.MainActivity.n_onCreate(Native Method)
at md519be914b4420cc6ce5355b8c56ac9928.MainActivity.onCreate(MainActivity.java:37)
at android.app.Activity.performCreate(Activity.java:6500)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3072)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3218)
at android.app.ActivityThread.access$1000(ActivityThread.java:198)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1676)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6837)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Comment 2 Rui Marinho 2016-04-13 19:03:47 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.
 
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Warm regards,
Xamarin Forms Team