roubachof / Maui.Nuke

Maui version of the Nuke iOS image caching native library
MIT License
43 stars 0 forks source link

Null reference exception when using UriImageSource #3

Open JosueDM94 opened 1 year ago

JosueDM94 commented 1 year ago

Description UriImageSource is not displayed when using Nuke package.

Steps to Reproduce

  1. Create a new MAUI app with the default template
  2. Add Nuget Sharpnado.Maui.Nuke
  3. Initialize Nuke as described in Maui.Nuke
  4. Add an Image control with a Uri Source `<Image Aspect="Fill" WidthRequest="162" HeightRequest="162"> `
  5. You won't see the image displayed

Affected platforms iOS

Did you find any workaround? nope

Version with bug 10.11.2

Application Output

Microsoft.Maui.UriImageSourceService: Information: Loading "https://en.wikipedia.org/wiki/Image#/media/File:Image_created_with_a_mobile_phone.png" as a web URL
Microsoft.Maui.UriImageSourceService: Error: Fail to load image: https://en.wikipedia.org/wiki/Image#/media/File:Image_created_with_a_mobile_phone.png

System.NullReferenceException: Object reference not set to an instance of an object.
   at Maui.Nuke.NukeController.LoadImageAsync(NSUrl url, Action`1 onFail)
   at Maui.Nuke.NukeUriImageSourceService.GetImageAsync(IImageSource imageSource, Single scale, CancellationToken cancellationToken)
Microsoft.Maui.UriImageSourceService: Information: Loading "https://en.wikipedia.org/wiki/Image#/media/File:Image_created_with_a_mobile_phone.png" as a web URL
Microsoft.Maui.UriImageSourceService: Error: Fail to load image: https://en.wikipedia.org/wiki/Image#/media/File:Image_created_with_a_mobile_phone.png

Anything else? Thanks in advance for this AMAZING library!

nanthakumaran-s commented 6 months ago

Hi @JosueDM94, Are you having any workaround to make this work? I'm also facing this issue.

roubachof commented 6 months ago

Did you forget to initialize the library ?

nanthakumaran-s commented 6 months ago

I have initialised and getting this same issue.

JosueDM94 commented 6 months ago

Hey @nanthakumaran-s, I haven't found a workaround for UriImageSource, I just removed NukeUriImageSourceService from the container and used FFImageLoading.Compat.

@roubachof the library was initialized