Skip to content

Android: Updating Image.Source with ImageSource.FromStream() is broken in Release builds #19

@Ahamed-Ali

Description

@Ahamed-Ali

Description

Description
In Android Debug builds, updating images works as expected. In Android Release builds, images updated with images created with ImageSource.FromStream() do not update.

The attached samples is a boiler plate VS MAUI Android app with the addition of method Bug(), which updates the content of the image.

Steps to Reproduce
Build & run the attached sample using Debug build.
Click the button
The MAUI image updates to the image created from the embedded "jpegImageBytes".
Build & run the attached samples using Release build.
Click the button
The image does not update as expected (original image disappears but new image is not shown).
AndroidImageBug.zip

Cause Hint

When AndroidMarshalMethod is true, this release image disappear issue occured. when false, it is not occured

below is the reference link :
https://github.com/dotnet/core/blob/main/release-notes/10.0/preview/preview1/dotnetmaui.md#enable-marshal-methods-by-default

Link to public reproduction project repository
No response

Version with bug
10.0.0-preview.6

Is this a regression from previous behavior?
Not sure, did not test other versions

Last version that worked well
Unknown/Other

Affected platforms
Android

Affected platform versions
I only tested Android 34 simulator and Android 35 phone.

Did you find any workaround?
No workaround found, but loading images from a file instead of a MemoryStream seems to work normally.

Relevant log output
Release builds show the following errors in the debug log:

07-21 04:09:39.116 D/OpenGLRenderer(12106): --- Failed to create image decoder with message 'unimplemented'
07-21 04:09:39.118 D/OpenGLRenderer(12106): --- Failed to create image decoder with message 'unimplemented'
07-21 04:09:39.119 D/OpenGLRenderer(12106): --- Failed to create image decoder with message 'unimplemented'
07-21 04:09:39.120 D/OpenGLRenderer(12106): --- Failed to create image decoder with message 'unimplemented'
07-21 04:09:39.120 D/OpenGLRenderer(12106): --- Failed to create image decoder with message 'unimplemented'
07-21 04:09:39.121 D/OpenGLRenderer(12106): --- Failed to create image decoder with message 'unimplemented'
07-21 04:09:39.128 W/Glide (12106): Load failed for [mono.android.runtime.InputStreamAdapter@9c00d6] with dimensions [915x509]
07-21 04:09:39.128 W/Glide (12106): class com.bumptech.glide.load.engine.GlideException: Failed to load resource
07-21 04:09:39.128 W/Glide (12106): Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{InputStreamAdapter->Object->Drawable}, LOCAL
07-21 04:09:39.128 W/Glide (12106): Cause (1 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{InputStreamAdapter->Drawable->Drawable}
07-21 04:09:39.128 W/Glide (12106): Cause (2 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{InputStreamAdapter->GifDrawable->Drawable}
07-21 04:09:39.128 W/Glide (12106): Cause (3 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{InputStreamAdapter->Bitmap->BitmapDrawable}
07-21 04:09:39.128 W/Glide (12106): Cause (4 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{InputStreamAdapter->BitmapDrawable->Drawable}
07-21 04:09:39.130 W/Glide (12106): Load failed for [crc6488302ad6e9e4df1a.ImageLoaderCallback@d6e6cf1] with dimensions [915x509]
07-21 04:09:39.130 W/Glide (12106): class com.bumptech.glide.load.engine.GlideException: Failed to load resource

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

10.0.0-preview.6

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI, Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 33

Did you find any workaround?

No response

Relevant log output

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions