Description
We have some PNGs that we display via a ViewModel. The property on the ViewModel is an ImageSource
Most of the images live directly under Resources/Images but some are in a subfolder called "signal". All the images have the Build Action of MauiImage
In the ViewModel we load those images into the ImageSource like this:
this.Image = Microsoft.Maui.Controls.ImageSource.FromFile("signal/red_hexagon1.png");
In Android this works fine. In iOS it does not work and we see the following error message in the Output window
[0:] Microsoft.Maui.FileImageSourceService: Warning: Unable to load image file 'Signal/red_hexagon.png'.
System.InvalidOperationException: Unable to load image file.
at Microsoft.Maui.FileImageSourceService.GetImageAsync(IFileImageSource imageSource, Single scale, CancellationToken cancellationToken)
If I move the image into root of "Resources/Images" the image loads fine.
This fails on both the Device (iOS 17.4.1) and Simulator (iPhone 15 iOS 17.4)
It works fine on Android
Steps to Reproduce
Call Microsoft.Maui.Controls.ImageSource.FromFile on iOS with an Image in a sub folder of Resources/Images
Link to public reproduction project repository
No response
Version with bug
8.0.40 SR5
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS 17.4.x
Did you find any workaround?
Move image to the root.
Relevant log output
[0:] Microsoft.Maui.FileImageSourceService: Warning: Unable to load image file 'Signal/red_hexagon.png'.
System.InvalidOperationException: Unable to load image file.
at Microsoft.Maui.FileImageSourceService.GetImageAsync(IFileImageSource imageSource, Single scale, CancellationToken cancellationToken)
Description
We have some PNGs that we display via a ViewModel. The property on the ViewModel is an ImageSource
Most of the images live directly under Resources/Images but some are in a subfolder called "signal". All the images have the Build Action of MauiImage
In the ViewModel we load those images into the ImageSource like this:
this.Image = Microsoft.Maui.Controls.ImageSource.FromFile("signal/red_hexagon1.png");In Android this works fine. In iOS it does not work and we see the following error message in the Output window
If I move the image into root of "Resources/Images" the image loads fine.
This fails on both the Device (iOS 17.4.1) and Simulator (iPhone 15 iOS 17.4)
It works fine on Android
Steps to Reproduce
Call Microsoft.Maui.Controls.ImageSource.FromFile on iOS with an Image in a sub folder of Resources/Images
Link to public reproduction project repository
No response
Version with bug
8.0.40 SR5
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS 17.4.x
Did you find any workaround?
Move image to the root.
Relevant log output
[0:] Microsoft.Maui.FileImageSourceService: Warning: Unable to load image file 'Signal/red_hexagon.png'. System.InvalidOperationException: Unable to load image file. at Microsoft.Maui.FileImageSourceService.GetImageAsync(IFileImageSource imageSource, Single scale, CancellationToken cancellationToken)