Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java.Lang.NullPointerException exception on FFImageLoading.Cache.ReuseBitmapDrawableCache #1281

Open
EmilAlipiev opened this issue May 25, 2019 · 4 comments
Labels

Comments

@EmilAlipiev
Copy link

EmilAlipiev commented May 25, 2019

I am not able to reproduce this issue but i am seeing this exceptions in my appcenter logs. do you have any idea what could be the problem? I am always using latest version of the library and XF 3.6


Android: 8.0.0
Android Build: HUAWEIANE-LX1
Manufacturer: HUAWEI
Model: ANE-LX1
 

Xamarin Exception Stack:
Java.Lang.NullPointerException: key == null || value == null
  at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) <0xc6fd0a48 + 0x000d7> in <20c4cde61dc345d982348d283007001a>:0
  at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeNonvirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) <0xc6fa2afc + 0x000af> in <20c4cde61dc345d982348d283007001a>:0
  at Android.Util.LruCache.Put (Java.Lang.Object key, Java.Lang.Object value) <0xc733012c + 0x0013b> in <eb0f7201496a41f28d617743f2ad75d3>:0
  at FFImageLoading.Cache.ByteBoundStrongLruCache`1[TValue].Add (System.String key, TValue value) <0xc431e098 + 0x0008f> in <e726c01889a34a5eaafa84d2b51bb1f0>:0
  at FFImageLoading.Cache.ReuseBitmapDrawableCache`1[TValue].DemoteDisplayedEntryToReusePool (TValue value) <0xc431cac0 + 0x0033f> in <e726c01889a34a5eaafa84d2b51bb1f0>:0
  at FFImageLoading.Cache.ReuseBitmapDrawableCache`1[TValue].OnEntryNoLongerDisplayed (System.Object sender, System.EventArgs args) <0xc431c294 + 0x0009b> in <e726c01889a34a5eaafa84d2b51bb1f0>:0
  at FFImageLoading.Drawables.SelfDisposingBitmapDrawable.SetIsDisplayed (System.Boolean isDisplayed) <0xc4314ad4 + 0x001b7> in <e726c01889a34a5eaafa84d2b51bb1f0>:0
  at FFImageLoading.Drawables.FFBitmapDrawable.SetIsDisplayed (System.Boolean isDisplayed) <0xc4315390 + 0x0001f> in <e726c01889a34a5eaafa84d2b51bb1f0>:0
  at FFImageLoading.Drawables.SelfDisposingBitmapDrawable.SetNoLongerDisplayed () <0xc43149d8 + 0x0007b> in <e726c01889a34a5eaafa84d2b51bb1f0>:0
  at FFImageLoading.Drawables.SelfDisposingBitmapDrawable.Dispose (System.Boolean disposing) <0xc431514c + 0x00007> in <e726c01889a34a5eaafa84d2b51bb1f0>:0
  at Java.Lang.Object.Finalize () <0xc742cd24 + 0x000df> in <eb0f7201496a41f28d617743f2ad75d3>:0
  at java.lang.NullPointerException: key == null || value == null
  at android.util.LruCache.put(LruCache.java:166)
@daniel-luberda
Copy link
Member

Hi @EmilAlipiev :)

Somehow image with null key is added to memory cache.

  • Do you use any custom keys for image loading?
  • Do you use Stream image sources?

@EmilAlipiev
Copy link
Author

Hi Daniel,

sorry for late answer. I had ignored this error but recently it occurred again. actually I dont use any custom key or no image streaming. I am mostly using images directly on xaml in listview with remote urls. so they are getting downloaded as user scrolls in the list. it can be that user scrolls very fast and it causes this crash.

@EmilAlipiev
Copy link
Author

there is a related report from the same phone I guess. maybe this might give more information

JniEnvironment+InstanceMethods.CallNonvirtualObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args)
JniPeerMembers+JniInstanceMethods.InvokeNonvirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters)
LruCache.Put (Java.Lang.Object key, Java.Lang.Object value)
ByteBoundStrongLruCache`1[TValue].Add (System.String key, TValue value)
ReuseBitmapDrawableCache`1[TValue].DemoteDisplayedEntryToReusePool (TValue value)
ReuseBitmapDrawableCache`1[TValue].OnEntryNoLongerDisplayed (System.Object sender, System.EventArgs args)
SelfDisposingBitmapDrawable.SetIsDisplayed (System.Boolean isDisplayed)
FFBitmapDrawable.SetIsDisplayed (System.Boolean isDisplayed)
SelfDisposingBitmapDrawable.SetNoLongerDisplayed ()
SelfDisposingBitmapDrawable.Dispose (System.Boolean disposing)
Object.Finalize ()

@EmilAlipiev
Copy link
Author

I could reproduce this issue but i dont know the exact reason.
This is happening with SVG images. my svg images are all local, not remote. when i load svg images on listview which is on modalpage and while images are loading if i pop the modal page, this crash is happening. it doesnt happen always. So probably there is a state cannot be disposable and when you try to dispose the page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants