Bug 57037 - Java.Interop.JniEnvironmentException of type 'Java.Lang.Error' was thrown.
Summary: Java.Interop.JniEnvironmentException of type 'Java.Lang.Error' was thrown.
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.4
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Paul DiPietro [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-06-01 08:07 UTC by Alessandro
Modified: 2017-06-19 18:44 UTC (History)
3 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 ANSWERED

Description Alessandro 2017-06-01 08:07:11 UTC
Today Insight sent me an email.

Android 4.4
Device Motorola TC70

I have no other info...

 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <db6f2cf37b7242ed8422f46b60045297>:0 
  at Java.Interop.JniEnvironment+StaticMethods.CallStaticObjectMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <9cc3a69207ce406c9d962c6ebf0c95ce>:0 
  at Java.Interop.JniPeerMembers+JniStaticMethods.InvokeObjectMethod (System.String encodedMember, Java.Interop.JniArgumentValue* parameters) [0x00018] in <9cc3a69207ce406c9d962c6ebf0c95ce>:0 
  at Android.Graphics.BitmapFactory.DecodeResource (Android.Content.Res.Resources res, System.Int32 id) [0x00044] in <bd067757b480456db5337308dd8ce429>:0 
  at Android.Graphics.BitmapFactory+<>c__DisplayClass25_0.<DecodeResourceAsync>b__0 () [0x00000] in <bd067757b480456db5337308dd8ce429>:0 
  at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <db6f2cf37b7242ed8422f46b60045297>:0 
  at System.Threading.Tasks.Task.Execute () [0x00010] in <db6f2cf37b7242ed8422f46b60045297>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <db6f2cf37b7242ed8422f46b60045297>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <db6f2cf37b7242ed8422f46b60045297>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <db6f2cf37b7242ed8422f46b60045297>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <db6f2cf37b7242ed8422f46b60045297>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <db6f2cf37b7242ed8422f46b60045297>:0 
  at Xamarin.Forms.Platform.Android.FileImageSourceHandler+<LoadImageAsync>d__4.MoveNext () [0x00138] in <1481f85a917c4f2b882ea161e9bc082f>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <db6f2cf37b7242ed8422f46b60045297>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <db6f2cf37b7242ed8422f46b60045297>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <db6f2cf37b7242ed8422f46b60045297>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <db6f2cf37b7242ed8422f46b60045297>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <db6f2cf37b7242ed8422f46b60045297>:0 
  at Xamarin.Forms.Platform.Android.ImageRenderer+<UpdateBitmap>d__9.MoveNext () [0x00148] in <1481f85a917c4f2b882ea161e9bc082f>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <db6f2cf37b7242ed8422f46b60045297>:0 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in <db6f2cf37b7242ed8422f46b60045297>:0 
  at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <bd067757b480456db5337308dd8ce429>:0 
  at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <bd067757b480456db5337308dd8ce429>:0 
  at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <bd067757b480456db5337308dd8ce429>:0 
  at (wrapper dynamic-method) System.Object:b9f47070-0195-4ab7-b37e-9c517f0f690a (intptr,intptr)
  --- End of managed Java.Lang.Error stack trace ---
java.lang.OutOfMemoryError
	at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
	at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:594)
	at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:429)
	at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:452)
	at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:482)
	at dalvik.system.NativeStart.run(Native Method)
Comment 1 Paul DiPietro [MSFT] 2017-06-01 14:16:37 UTC
Can't do a lot here without a reproduction project. Leaving as needinfo for now.
Comment 2 Alessandro 2017-06-01 14:22:36 UTC
Paul I know that are few informations, but can you understand where could be a problem? It's an OutOfMemory, there is Android.Graphics.BitmapFactory...

Can be something with ListView?
Comment 3 Paul DiPietro [MSFT] 2017-06-01 14:54:52 UTC
Most obviously it could be the size of the images being used. If your'e using ListView as you seem to be implying, are you using RecycleElement? Has this crash report only been sent one time out of a long period?
Comment 4 Alessandro 2017-06-01 21:32:14 UTC
ok Paul
it should be problem with ListView.
If I scroll it very fast, OutOfMemory appears.
If I force ListViewCachingStrategy.RecycleElement, I can scroll fast and the error does not appears
Comment 5 Paul DiPietro [MSFT] 2017-06-19 18:44:55 UTC
If it works as you stated, in this situation I would suggest using RecycleElement as its purpose is to help with memory consumption. An older device might otherwise experience issues as you're seeing without it.