Closed AntPolkanov closed 1 year ago
BitmapFactory
is an Android Runtime API and not an MAUI UI one. IMO this looks more like a runtime issue than anything specific to code here, @jonathanpeppers what do you think?
We just bind the Android APIs to C# as-is, so aren't much involved in what they actually do. One difference is that .NET 8 Preview 6 now uses Android API 34 as the targetSdkVersion
. There could be different behavior (bugs?) in the newest version of Android.
@AntPolkanov can you share a more complete Android log? Try this:
# clear the log
adb logcat -c
# enable moar logging
adb shell setprop debug.mono.log default,assembly,mono_log_level=debug,mono_log_mask=all
# cause the app to crash again, save the log
adb logcat -d > log.txt
Share the log.txt
file here, thanks!
Hi @AntPolkanov. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
Thanks for looking into this, guys! @jonathanpeppers , please find the log attached.
If you add to your project:
<PropertyGroup>
<AndroidEnableMarshalMethods>false</AndroidEnableMarshalMethods>
</PropertyGroup>
Log messages like this should go away:
08-07 08:59:44.386 6005 6005 D monodroid-assembly: MM: Trying to look up pointer to method 'n_OnDraw_Landroid_graphics_drawable_shapes_Shape_Landroid_graphics_Canvas_Landroid_graphics_Paint__mm_wrapper(IntPtr,IntPtr,IntPtr,IntPtr,IntPtr)' (token 0x60024a4) in class 'Android.Graphics.Drawables.ShapeDrawable, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' (index 40)
Does the problem go away with AndroidEnableMarshalMethods=false
?
We have this feature disabled by default in the next release, and plan to make it "experimental" for .NET 8.
@jonathanpeppers , it did help! Thank you. The issue can be closed.
Thanks I will put your sample on the list to test if we turn on AndroidEnableMarshalMethods again.
Description
I am using the FFImageLoading.Compat package to display jpg images in
CachedImage
. The package works fine on .NET 7 (Android and iOS), but fails on the latest .NET 8-preview.6 (Android only) in the Release mode (works in Debug though).I pulled the package and added logging. It turns out that
DecodeAsync()
method in theBaseDecoder.cs
class fails when it callsawait BitmapFactory.DecodeStreamAsync(imageData, null, options).ConfigureAwait(false);
, see the exact line here: https://github.com/Redth/FFImageLoading.Compat/blob/3b171816d95b6d40d726dfe541d59c21acb29a8e/source/FFImageLoading/Platforms/Android/Decoders/BaseDecoder.cs#L41C28-L41C28 (cc: @Redth)The error happens when
libc
callsmemcpy()
. The tombstone file and logcat can be found in the reproduction repo.This issue blocks us from releasing our .NET MAUI app on Android.
Steps to Reproduce
FFImageLoading.Compat
packageCachedImage
on a pageExpected result: the image appears on the page Actual result: the app crashes
Link to public reproduction project repository
https://github.com/AntPolkanov/MAUI.Bug.FFImageLoadingCompat
Version with bug
8.0.0-preview.6.8686
Last version that worked well
7.0.92
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
No
Relevant log output