microspaze / FFImageLoading.Maui

FFImageLoading.Maui - Fast & Furious Image Loading for .NET MAUI
MIT License
83 stars 12 forks source link

Java.Lang.IllegalStateException: Unbalanced enter/exit on Android #41

Open jhovelnu opened 1 week ago

jhovelnu commented 1 week ago

Description

Net MAUI Android app crash with error:

Java.Interop.JniEnvironment.InstanceMethods.CallVoidMethod(JniObjectReference , JniMethodInfo , JniArgumentValue ) Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualVoidMethod(String , IJavaPeerable , JniArgumentValue ) Java.IO.InputStream.Close() Android.Runtime.InputStreamInvoker.Close() System.IO.Stream.Dispose() System.IO.BufferedStream.Dispose(Boolean ) System.IO.Stream.Close() System.IO.Stream.Dispose() System.IO.DelegatingStream.Dispose(Boolean ) System.IO.Stream.Close() System.IO.Stream.Dispose() FFImageLoading.ObjectExtensions.TryDispose(IDisposable obj) FFImageLoading.Cache.DownloadCache.<>cDisplayClass23_1.b1() System.Threading.CancellationToken.<>c.b12_0(Object obj) System.Threading.CancellationTokenSource.Invoke(Delegate , Object , CancellationTokenSource ) System.Threading.CancellationTokenSource.CallbackNode.<>c.b9_0(Object s) System.Threading.ExecutionContext.RunInternal(ExecutionContext , ContextCallback , Object ) System.Threading.ExecutionContext.RunInternal(ExecutionContext , ContextCallback , Object ) System.Threading.CancellationTokenSource.CallbackNode.ExecuteCallback() System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(Boolean ) java.lang.IllegalStateException: Unbalanced enter/exit com.android.okhttp.okio.AsyncTimeout.enter AsyncTimeout.java:64 com.android.okhttp.okio.AsyncTimeout$2.read AsyncTimeout.java:211 com.android.okhttp.okio.RealBufferedSource.read RealBufferedSource.java:51 com.android.okhttp.internal.http.Http1xStream$FixedLengthSource.read Http1xStream.java:395 com.android.okhttp.internal.Util.skipAll Util.java:165 com.android.okhttp.internal.Util.discard Util.java:147 com.android.okhttp.internal.http.Http1xStream$FixedLengthSource.close Http1xStream.java:412 com.android.okhttp.okio.RealBufferedSource.close RealBufferedSource.java:397 com.android.okhttp.okio.RealBufferedSource$1.close RealBufferedSource.java:385

Java.Lang.IllegalStateException: Unbalanced enter/exit on Android

Steps to Reproduce

1 - Create a Net Maui Project 2 - Implement the FFimageloading 3 - Set image source from external url 4 - Sometimes the app crashes

Expected Behavior

App working well

Actual Behavior

The app crashes

Basic Information

This same issue was reported for Xamarin forms: https://github.com/luberda-molinet/FFImageLoading/issues/1492

This Screenshot is from app center where all the exceptions are logged

image

microspaze commented 1 week ago

@jhovelnu I think I had already fixed this issue by 1.2.4 (For fix Android app crashes when using using multiple CachedImage for showing multiple gifs #35). You can try the latest version to verify it.