dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.28k stars 1.76k forks source link

[Android] URL images loaded at runtime disappear after navigating away and back #14205

Open Chase-PocketBard opened 1 year ago

Chase-PocketBard commented 1 year ago

Description

When using data binding to point the source of an Image to a URL, then changing the source while running the application, the image loads at first, but upon navigating away and back to the page containing the image, it does not appear.

The expected behavior seems to work on Windows (not tested on Mac or iOS), but on my Android 12 device it does not. As far as I have been able to investigate, this only seems to happen to downloaded images, cached or not.

https://user-images.githubusercontent.com/115745354/227749285-1a4157ef-71f5-4828-9b45-6df7820afc4c.mp4

Steps to Reproduce

  1. Create a .NET MAUI application using Shell navigation with at least 2 pages and implementing MVVM pattern.
  2. On any page, add an Image with its source data-bound in the View Model.
  3. On that page, add some way of changing the data-bound image to any public image URL at runtime. A button will suffice.
  4. Run the application on Android 12 or later
  5. Change the image at runtime (by pressing the button, if you chose that option)
  6. Navigate to another tab
  7. Navigate back.

Expected outcome: The image that loaded before should still be there. Actual outcome: No image appears.

Link to public reproduction project repository

https://github.com/Chase-PocketBard/Maui-Image-Issue

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 12

Did you find any workaround?

No response

Relevant log output

No response

ghost commented 1 year ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

mtmgoliath commented 1 year ago

I've found a work-around, see comment below on related issue

https://github.com/dotnet/maui/issues/14471#issuecomment-1534974522

Zhanglirong-Winnie commented 1 year ago

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 1.0. Can repro on android platform with sample project. Maui-Image-Issue-main.zip 14205

Hrishikesh46779 commented 7 months ago

Same issue for me. After navigating to other pages and coming back to the mainpage where the image was present, the image becomes blank. Visual studio version 17.9.6

https://github.com/dotnet/maui/assets/46864647/6faa3edf-acb0-4ac5-a300-c4a74ce1c3de