dotnet/maui

The image is not rendered on iOS only the first time

try0 opened this issue · 8 comments

try0 commented

Description

The image is not rendered on iOS only the first time when the image source is set in code-behind.

Not rendered at page initialization.
https://github.com/try0/MauiAppTest/blob/main/MauiAppTest/MainPage.xaml.cs#L11

When the source is set up again, it is render correctly.
https://github.com/try0/MauiAppTest/blob/main/MauiAppTest/MainPage.xaml.cs#L26

Steps to Reproduce

  1. Sets source in code-behind.
  2. Run on iOS.

Link to public reproduction project repository

https://github.com/try0/MauiAppTest

Version with bug

6.0.400

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS15

Did you find any workaround?

After copying the file to the cache directory, loading it using ImageSource.FromFile renders fine.

Relevant log output

No response

@try0 : I can't test on IOS, but I think you can try this:

  1. In the MainPage.xaml, add the event Loaded="ContentPage_Loaded"
  2. In the MainPage.xaml.cs replace All RenderImageAsync(); by await RenderImageAsync();
  3. In the MainPage.xaml.cs replace private void RenderImageAsync() by private async Task RenderImageAsync()
  4. In the MainPage.xaml.cs in the constructor move await RenderImageAsync(); to the function private async void ContentPage_Loaded(object sender, EventArgs e)

Sample to test on IOS:
MauiAppTestIOS.zip

try0 commented

@AlanGusLive

Thanks for suggesting a workaround.
However the result was the same, not rendered.

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 1.0. Can repro on iOS platform with sample project. MauiAppTest

@try0 Did you ever solve it, got the same issue @jsuarezruiz Any ideas why this happens? If I debug it the stream is loaded so why would it not display?

try0 commented

@jadenrogers

No, I never did.
See Did you find any workaround?