Open mapsouza opened 4 days ago
This issue has been verified using Visual Studio 17.13 Preview 1 (9.0.10 & 8.0.100 & 8.0.83). Can repro this issue on Android platform.
Same problem observed here, dotnet 9.0.0.
From the documentation
FileSystem.OpenAppPackageFileAsync
Files that were added to the project with the Build Action of MauiAsset can be opened with this method. .NET MAUI projects will process any file in the Resources\Raw folder as a MauiAsset.
There seems to be a tolerance on iOS with MauiImage.
Here's a simple workaround:
In your .csproj
after:
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
Add the following line:
<!--to allow FileSystem.OpenAppPackageFileAsync on image-->
<MauiAsset Include="Resources\Images\*" LogicalName="%(RecursiveDir)%(Filename)%(Extension)"/>
Same problem observed here, dotnet 9.0.0.
From the documentation
FileSystem.OpenAppPackageFileAsync Files that were added to the project with the Build Action of MauiAsset can be opened with this method. .NET MAUI projects will process any file in the Resources\Raw folder as a MauiAsset.
Above, it is documented that it opens any file within the package and in the platform section, it states that it only opens MauiAsset. But this information are in all platforms.
I think this worked in a past because @jfversluis have's a post in your blog and a demo written in .net 7.
Description
I used FileSystem.OpenAppPackageFileAsync to get a Stream from a MauiImage. On iOS all works is fine. But in Android throws System.IO.FileNotFoundException
Steps to Reproduce
Put this code in OnCounterClicked event: `
}
`
Link to public reproduction project repository
https://github.com/mapsouza/FileNotFoundImage
Version with bug
8.0.100 SR10
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
No response
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output