maui
maui copied to clipboard
Returning UIImage in custom ImageSourceService doesn't trigger an UI update
Description
Hi there !
https://github.com/roubachof/Maui.Nuke has a weird issue when returning a valid UIImage with ImageSourceServiceResult. It doesn't seem to trigger the display of the image right away... But if you force the layout to refresh, the UIImage renders correctly.
I'm plugging into Image service architecture in order to use ImageCaching.Nuke
nuget (which is a swift binding).
public static class ImageSourcesMauiAppBuilderExtensions
{
public static MauiAppBuilder UseNuke(this MauiAppBuilder builder, bool showDebugLogs = false)
{
#if __IOS__
NukeController.ShowDebugLogs = showDebugLogs;
builder.ConfigureImageSources(services =>
{
services.AddService(
svcs => new NukeFileImageSourceService(
svcs.GetService<ILogger<FileImageSourceService>>()));
services.AddService(
svcs => new NukeUriImageSourceService(
svcs.GetService<ILogger<UriImageSourceService>>()));
services.AddService<FileImageSource>(
svcs => new NukeFileImageSourceService(
svcs.GetService<ILogger<FileImageSourceService>>()));
services.AddService<UriImageSource>(
svcs => new NukeUriImageSourceService(
svcs.GetService<ILogger<UriImageSourceService>>()));
});
#endif
return builder;
}
}
Steps to Reproduce
- Create new MAUI app with the default template
- Clone https://github.com/roubachof/Maui.Nuke next to your app
- Reference Maui.Nuke csproj in your app
- Initialize Nuke as described in Maui.Nuke
- put a breakpoint in https://github.com/roubachof/Maui.Nuke/blob/d8682d833abd7cd6bafb2e82e46e5e72d3823b47/Maui.Nuke/NukeFileImageSourceService.cs#L105
- You will see UIImage is not null and valid, but you won't see the bot displayed
- If you click the button, image appears
Link to public reproduction project repository
https://github.com/roubachof/Maui.Nuke
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS
Did you find any workaround?
nope
Relevant log output
nothing here
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.
I'm facing this issue as well on iOS.
@PureWeen do you know if this can be fixed by using a custom handler in .NET MAUI somehow? 🤔
Thanks in advance
Maybe this can improve performance a lot for Maui in iOS when rendering images lots os images in a collection view or bindable layout. @jonathanpeppers what do you think? Maybe integrate it natively on MAUI?
Thank you
Verified this issue with VSM 17.6.7 (build 417). Can repro on ios platform.
Just tested with .net8 MAUI, and still failing
https://github.com/roubachof/Maui.Nuke
Hello @roubachof , I'm wondering if you had opportunity to review my comment here on how I solved the issue for my project: https://github.com/roubachof/Maui.Nuke/issues/2#issuecomment-1555198169 in .NET 7+
I'm not sure if that will solve the issue 100% but just wanted to share my grain of salt 😃 .
Regards
I tested it with .net 7 and .net 8, same issue