CommunityToolkit / CommunityToolkit/dotnet

[BUG] Resizetizer file access issues on Windows build in Visual Studio in CommunityToolkit.Mvvm 8.2.2

Open
#883 11 comments 0 reactions 0 assignees View on GitHub
external :arrow_heading_up: mvvm-toolkit :toolbox:
Dominant language
C#
Stars
3.8k
Forks
400
PR merge metrics
No merged PRs in 30d

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Did you read the "Reporting a bug" section on Contributing file?

- [X] 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

1. Open the project attached here.
2. Build for Android or iOS

[test-issue.zip](https://github.com/CommunityToolkit/Maui/files/15476857/test-issue.zip)

### Link to public reproduction project repository

Attached to this issue

### Environment

```markdown
- .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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.