CommunityToolkit / CommunityToolkit/dotnet

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

Aperta
#883 11 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

external :arrow_heading_up: mvvm-toolkit :toolbox:
Lingua principale
C#
Stelle
3.8k
Fork
400
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Is there an existing issue for this?
  • I have searched the existing issues
Did you read the "Reporting a bug" section on Contributing file?
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

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con il progetto allegato test-issue.zip e riproduci la build di Windows Visual Studio per Android o iOS, confrontando il comportamento di PNG e SVG. Poi esamina la voce dello stack trace di Resizetizer alla riga 105 di ResizetizeImages.cs e la voce di build Microsoft.Maui.Resizetizer.After.targets. Il lavoro è completato quando il progetto viene compilato correttamente in Visual Studio su Windows senza l’errore di accesso negato a PNG.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
build-system
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.