Hello
I'm having really trouble with an error (actually crash) that is happening from time to time in my app. (under Android) Because I cannot pin it down, I made a very simple sample project showing the crash for you to reproduce.
I'm really desperate and do think that I did everything OK concerning Threading/UI Updates etc. so I think this is something of relevance for the Xamairn developers. I would be so glad if someone could have a look at this app. Im using Genymotion emulator with Samsung Galaxy S5 loaded.
What I do is simple:
- have a simple Listview with a dedicated itemtemplate class
- populate that listview with 1000 items during a button click
- the app will - when the button is clicked really fast again and again - CRASH
with this output: (after the debugger stopped immediately)
[mono] Unhandled Exception:
[mono] Java.Lang.NullPointerException: Exception of type 'Java.Lang.NullPointerException' was thrown.
[mono] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
[mono] 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
[mono] at Android.Runtime.JNIEnv.FinishCreateInstance (IntPtr instance, IntPtr jclass, IntPtr constructorId, 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:288
[mono] at Android.OS.Handler..ctor (Android.OS.Looper looper) [0x000ef] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.OS.Handler.cs:179
[mono] at Android.App.SyncContext.Post (System.Threading.SendOrPostCallback d, System.Object state) [0x00014] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/src/Android.App/SyncContext.cs:17
[mono] at System.Threading.Tasks.SynchronizationContextContinuation.Execute () [0x00000] in <filename unknown>:0
[mono] at System.Threading.Tasks.Task.ProcessCompleteDelegates () [0x00000] in <filename unknown>:0
[mono] at System.Threading.Tasks.Task.Finish () [0x00000] in <filename unknown>:0
[mono] at System.Threading.Tasks.Task`1[Android.Graphics.Bitmap].TrySetResult (Android.Graphics.Bitmap result) [0x00000] in <filename unknown>:0
[mono] at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[Android.Graphics.Bitmap].SetResult (Android.Graphics.Bitmap result) [0x00000] in <filename unknown>:0
[mono] at Xamarin.Forms.Platform.Android.FileImageSourceHandler+<LoadImageAsync>d__0.MoveNext () [0x00000] in <filename unknown>:0
[mono] at (wrapper unbox) Xamarin.Forms.Platform.Android.FileImageSourceHandler/<LoadImageAsync>d__0:MoveNext ()
[mono] at System.Threading.Tasks.AwaiterActionContinuation.Execute () [0x00000] in <filename unknown>:0
[mono] at System.Threading.Tasks.Task.ProcessCompleteDelegates () [0x00000] in <filename unknown>:0
[mono] at System.Threading.Tasks.Task.Finish () [0x00000] in <filename unknown>:0
[mono] at System.Threading.Tasks.Task.ThreadStart () [0x00000] in <filename unknown>:0
[mono] at System.Threading.Tasks.Task.Execute () [0x00000] in <filename unknown>:0
[mono] at System.Threading.Tasks.TpScheduler.TaskExecuterCallback (System.Object obj) [0x00000] in <filename unknown>:0
[mono] --- End of managed exception stack trace ---
[mono] java.lang.NullPointerException
[mono] at android.os.Handler.<init>(Handler.java:229)
[mono] at android.os.Handler.<init>(Handler.java:137)
[mono] at dalvik.system.NativeStart.run(Native Method)
[mono]