Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
SuperCorks opened this issue May 28, 2024 · 9 comments
Labels
external ⤴️ Something related to or caused by an external project mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit

Comments

@SuperCorks
Copy link

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

@SuperCorks
Copy link
Author

The workaround is reverting to

  • CommunityToolkit.Mvvm 8.0.0
  • CommunityToolkit.Maui 8.0.1

@bijington
Copy link

I suspect there is an issue in the .NET MAUI tooling and one of the versions of Visual Studio that you updated to brought that version of the workload in. Downgrading Visual Studio won't fix that.

You could try forcing the specific version of .NET MAUI to be something lower than the latest.

The issue sounds like the tooling is trying to resize your pngs which is something it shouldn't - this should only happen for SVGs. This is what makes me believe it is a tooling issue.

@Sergio0694
Copy link
Member

Should we close this and OP can reopen it in the MAUI repo?

@Sergio0694 Sergio0694 added external ⤴️ Something related to or caused by an external project mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit labels May 29, 2024
@SuperCorks
Copy link
Author

Ok thank you guys

@bijington
Copy link

bijington commented May 29, 2024

@SuperCorks are you happy to open an issue on the .NET MAUI repository? If so can you link it here just for traceability to help others that might encounter the same issue?

@Sergio0694 that sounds good to me, I don't have the power to do so.

@SuperCorks
Copy link
Author

Yes I'll do it before end of week

@MarkKananen
Copy link

This issue (at least for me) seems to be when images are readonly because they are not checked out in TFS. My work around is to just keep the image files checked out.

@MadManMarkAu
Copy link

I can confirm that @MarkKananen is 100% correct. The issue for me was caused by Team Foundation Server making the source files read-only when they are not checked out. Whatever process copies the source files into the /obj/ directory preserves that read-only attribute and causes the Resizetizer to fail. Checking out the app's resource images removes the read-only attribute from the source images, and the build process succeeds. The version of CommunityToolkit.Maui has no bearing on the success or failure when TFS is the cause.

@SuperCorks Did you end up opening an issue on the .NET MAUI repo? Can you link it here?

@SuperCorks
Copy link
Author

I did. Here it is
dotnet/maui#23397

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external ⤴️ Something related to or caused by an external project mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit
Projects
None yet
Development

No branches or pull requests

5 participants