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

ImageSource FromFile Android internal bug? #8809

Closed
AignerGames opened this issue Jul 18, 2022 · 2 comments · Fixed by #12310
Closed

ImageSource FromFile Android internal bug? #8809

AignerGames opened this issue Jul 18, 2022 · 2 comments · Fixed by #12310
Labels
area-controls-image Image control fixed-in-7.0.59 Look for this fix in 7.0.59! fixed-in-7.0.100 fixed-in-7.0.101 fixed-in-8.0.0-preview.1.7762 Look for this fix in 8.0.0-preview.1.7762! high It doesn't work at all, crashes or has a big impact. platform/android 🤖 t/bug Something isn't working

Comments

@AignerGames
Copy link

Description

Sorry I don't have many details, but the implementation of ImageSource.FromFile (which uses a FileImageSource) seems to have bug in the implementation which causes issues on Android.

For example when I use a Image which is bound to an ImageSource which was loaded with ImageSource.FromFile and then change tab a few time or scroll down / up it will suddenly throw a exception Canvas: trying to use a recycled bitmap android.

Doing the same thing but loading the file stream manually with ImageSource.FromStream works and doesn't cause any of these issues.

Steps to Reproduce

1, Load image file with ImageSource.FromFile
2, Bind the ImageSource to an Image inside a Tab
3. Change the Tab a few times until Android (randomly?) throws a exception Canvas: trying to use a recycled bitmap android

Version with bug

6.0.408 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 11

Did you find any workaround?

Use ImageSource.FromStream and manually load the file stream instead of using ImageSource.FromFile

Relevant log output

No response

@AignerGames AignerGames added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Jul 18, 2022
@rmarinho
Copy link
Member

Thank you so much for your bug report! Unfortunately, this report seems to be missing some details.
Ideally we would love to have a minimal, reproducible example that you upload to a GitHub repository and link us to. That should greatly speed up the process, thanks!

@rmarinho rmarinho added platform/android 🤖 area-image Image loading, sources, caching and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Jul 18, 2022
@AignerGames
Copy link
Author

AignerGames commented Jul 18, 2022

I tried to upload a example which causes the Exception on my Android 11 Lenovo Tablet
(The VS Git dialog reported a weird warning, I hope everything is included)

I noticed that the Image size makes a different. I set the Width/Height Requested to 300 and nothing happend, after
I removed them and let the Image containt the full size the Exception happend again

Test Project

The project can also be used to test this issue:
#8787 (comment)

@jfversluis jfversluis added this to the .NET 7 Planning milestone Jul 28, 2022
@samhouts samhouts added the high It doesn't work at all, crashes or has a big impact. label Sep 29, 2022
@hartez hartez moved this from Todo to In Progress in MAUI SDK Ongoing Dec 28, 2022
@github-project-automation github-project-automation bot moved this from In Progress to Done in MAUI SDK Ongoing Dec 28, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jan 27, 2023
@samhouts samhouts added the fixed-in-7.0.59 Look for this fix in 7.0.59! label Feb 16, 2023
@samhouts samhouts added the fixed-in-8.0.0-preview.1.7762 Look for this fix in 8.0.0-preview.1.7762! label Feb 22, 2023
@Eilon Eilon added area-controls-image Image control and removed area-image Image loading, sources, caching labels May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-image Image control fixed-in-7.0.59 Look for this fix in 7.0.59! fixed-in-7.0.100 fixed-in-7.0.101 fixed-in-8.0.0-preview.1.7762 Look for this fix in 8.0.0-preview.1.7762! high It doesn't work at all, crashes or has a big impact. platform/android 🤖 t/bug Something isn't working
Projects
None yet
5 participants