Description
Is there an existing issue for this?
- I have searched the existing issues
Did you read the "Reporting a bug" section on Contributing file?
- I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
Current Behavior
Recently I’ve been encountering this error with Resizetizer on build.
Severity Code Description Project File Line Suppression State
Error Access to the path 'C:\Milliman\DEVL\MOBILE\MAUI\Milliman.Benefits\Milliman.Benefits\obj\Debug\net8.0-android\resizetizer\r\drawable\settings.png' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.IO.File.OpenFile(String path, FileAccess access, SafeFileHandle& handle)
at System.IO.File.SetLastWriteTimeUtc(String path, DateTime lastWriteTimeUtc)
at Microsoft.Maui.Resizetizer.ResizetizeImages.ExecuteAsync() in D:\a\_work\1\s\src\SingleProject\Resizetizer\src\ResizetizeImages.cs:line 105
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute() Milliman.Benefits C:\Users\simon\.nuget\packages\microsoft.maui.resizetizer\8.0.40\buildTransitive\Microsoft.Maui.Resizetizer.After.targets 631
This error started occuring a few builds after I updated to 17.9.7. I also get this error with 17.10 preview 7.
If I run dotnet build from the terminal alone I still get this error, but if I run dotnet clean before the build works fine. In visual studio the build never works even if I clean before. I tried rolling back to 17.9.6 and I still get the issue.
See me reproducing the issue here: https://www.loom.com/share/8b4c17162bb54005a710a191a9e5d07c?sid=aede5d34-10f7-4f3c-ada2-29a17331b2e1
I also tried copying the project in another directory, same issue.
I'm also notiticing this only happens with .png files. Not svgs.
Expected Behavior
Build's successfully in visual studio for windows.
Steps To Reproduce
- Open the project attached here.
- Build for Android or iOS
Link to public reproduction project repository
Attached to this issue
Environment
- .NET MAUI CommunityToolkit.Mvvm: 8.2.2 (apparently it also happens with CommunityToolkit.Maui 9.0.0)
- OS: Windows 11 (Visual Studio)
- .NET MAUI: Latest
Anything else?
I opened an issue with the Visual Studio team: https://developercommunity.visualstudio.com/t/MAUI---Resizetizer-files-access-to-the-p/10662058