Skip to content

[Windows] Resizetizer occasionally fails on Azure DevOps pipelines #30900

@unrateddi

Description

@unrateddi

Description

Occasionally our builds on Azure DevOps (self-hosted instance) fails when building MAUI WinUI with the following error.

The process cannot access the file ... because it is being used by another process.

We noticed that Resizetizer doesn't handle icon generation specifically for WinUI here which results in the icons being resized by the generic part of the function here.

You will notice that the part that handles the resizing for WinUI resizes the icons twice in a row (can't find the reason for that) which explains the error we get (maybe mostly in slower self-hosted environments).

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

9.0.81 SR8.1

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows SDK 10.0.19041.0

Did you find any workaround?

Fix the double resizing here.
Ideally include a WinUI in the if else statement to handle WinUI icon resizing/generation properly here.

Relevant log output

C:\Users\x-user\.nuget\packages\microsoft.maui.resizetizer\9.0.81\buildTransitive\Microsoft.Maui.Resizetizer.After.targets(633,9): error MAUI0000: There was an exception processing the image 'C:\TFS\agent-x\_work\7\s\XApp\XApp.MAUI\XApp.MAUI\Resources\AppIcon\appicon.svg': System.IO.IOException: The process cannot access the file 'C:\TFS\agent-x\_work\7\s\XApp\XApp.MAUI\XApp.MAUI\obj\Release\net9.0-windows10.0.19041.0\win10-x64\resizetizer\r\appiconLogo.scale-200.png' because it is being used by another process. [C:\TFS\agent-x\_work\7\s\XApp\XApp.MAUI\XApp.MAUI\XApp.MAUI.csproj::TargetFramework=net9.0-windows10.0.19041.0]
C:\Users\x-user\.nuget\packages\microsoft.maui.resizetizer\9.0.81\buildTransitive\Microsoft.Maui.Resizetizer.After.targets(633,9): error MAUI0000:    at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) [C:\TFS\agent-x\_work\7\s\XApp\XApp.MAUI\XApp.MAUI\XApp.MAUI.csproj::TargetFramework=net9.0-windows10.0.19041.0]
C:\Users\x-user\.nuget\packages\microsoft.maui.resizetizer\9.0.81\buildTransitive\Microsoft.Maui.Resizetizer.After.targets(633,9): error MAUI0000:    at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode) [C:\TFS\agent-x\_work\7\s\XApp\XApp.MAUI\XApp.MAUI\XApp.MAUI.csproj::TargetFramework=net9.0-windows10.0.19041.0]
C:\Users\x-user\.nuget\packages\microsoft.maui.resizetizer\9.0.81\buildTransitive\Microsoft.Maui.Resizetizer.After.targets(633,9): error MAUI0000:    at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode) [C:\TFS\agent-x\_work\7\s\XApp\XApp.MAUI\XApp.MAUI\XApp.MAUI.csproj::TargetFramework=net9.0-windows10.0.19041.0]
C:\Users\x-user\.nuget\packages\microsoft.maui.resizetizer\9.0.81\buildTransitive\Microsoft.Maui.Resizetizer.After.targets(633,9): error MAUI0000:    at System.IO.File.Create(String path) [C:\TFS\agent-x\_work\7\s\XApp\XApp.MAUI\XApp.MAUI\XApp.MAUI.csproj::TargetFramework=net9.0-windows10.0.19041.0]
C:\Users\x-user\.nuget\packages\microsoft.maui.resizetizer\9.0.81\buildTransitive\Microsoft.Maui.Resizetizer.After.targets(633,9): error MAUI0000:    at Microsoft.Maui.Resizetizer.SkiaSharpAppIconTools.Save(SKBitmap tempBitmap, String destination, Func`1 getStream) in /_/src/SingleProject/Resizetizer/src/SkiaSharpAppIconTools.cs:line 75 [C:\TFS\agent-x\_work\7\s\XApp\XApp.MAUI\XApp.MAUI\XApp.MAUI.csproj::TargetFramework=net9.0-windows10.0.19041.0]
C:\Users\x-user\.nuget\packages\microsoft.maui.resizetizer\9.0.81\buildTransitive\Microsoft.Maui.Resizetizer.After.targets(633,9): error MAUI0000:    at Microsoft.Maui.Resizetizer.SkiaSharpAppIconTools.Resize(DpiPath dpi, String destination, Func`1 getStream) in /_/src/SingleProject/Resizetizer/src/SkiaSharpAppIconTools.cs:line 54 [C:\TFS\agent-x\_work\7\s\XApp\XApp.MAUI\XApp.MAUI\XApp.MAUI.csproj::TargetFramework=net9.0-windows10.0.19041.0]
C:\Users\x-user\.nuget\packages\microsoft.maui.resizetizer\9.0.81\buildTransitive\Microsoft.Maui.Resizetizer.After.targets(633,9): error MAUI0000:    at Microsoft.Maui.Resizetizer.ResizetizeImages.ProcessAppIcon(ResizeImageInfo img, ConcurrentBag`1 resizedImages) in /_/src/SingleProject/Resizetizer/src/ResizetizeImages.cs:line 231 [C:\TFS\agent-x\_work\7\s\XApp\XApp.MAUI\XApp.MAUI\XApp.MAUI.csproj::TargetFramework=net9.0-windows10.0.19041.0]
C:\Users\x-user\.nuget\packages\microsoft.maui.resizetizer\9.0.81\buildTransitive\Microsoft.Maui.Resizetizer.After.targets(633,9): error MAUI0000:    at Microsoft.Maui.Resizetizer.ResizetizeImages.<>c__DisplayClass34_0.<ExecuteAsync>b__0(ResizeImageInfo img) in /_/src/SingleProject/Resizetizer/src/ResizetizeImages.cs:line 63 [C:\TFS\agent-x\_work\7\s\XApp\XApp.MAUI\XApp.MAUI\XApp.MAUI.csproj::TargetFramework=net9.0-windows10.0.19041.0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-single-projectSplash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizert/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions