Skip to content

Android Uno.Resizetizer File Lock Build Issue #367

Description

@aritchie

Current behavior

I often receive this error (almost every other build) when Uno resizetizer kicks in

Error Uno.Resizetizer0000 : System.IO.IOException: The process cannot access the file '/Users/allanritchie/Desktop/Work/UnoDispatchScience/driverUno/driver/obj/Debug/net9.0-android/android-arm64/unoresizetizer/r/back.png' because it is being used by another process.
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Init(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Int64& fileLength, UnixFileMode& filePermissions)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.File.Create(String path)
   at Uno.Resizetizer.SkiaSharpTools.Save(String destination, SKBitmap tempBitmap)
   at Uno.Resizetizer.SkiaSharpTools.Resize(DpiPath dpi, String destination, Double additionalScale, Boolean dpiSizeIsAbsolute)
   at Uno.Resizetizer.Resizer.Rasterize(DpiPath dpi, String destination)
   at Uno.Resizetizer.Resizer.Resize(DpiPath dpi, String inputsFile)
   at Uno.Resizetizer.ResizetizeImages_31294831f78c245fe91395cd6d9058b84796bdfb.ProcessImageResize(ResizeImageInfo img, DpiPath[] dpis, ConcurrentBag`1 resizedImages)
   at Uno.Resizetizer.ResizetizeImages_31294831f78c245fe91395cd6d9058b84796bdfb.<>c__DisplayClass58_0.<ExecuteAsync>b__0(ResizeImageInfo img)
   at Uno.Resizetizer.AsyncTaskExtensions.<>c__DisplayClass0_0`1.<ParallelForEach>b__0(TSource s)

Expected behavior

It compiles without a build time error

How to reproduce it (as minimally and precisely as possible)

Build

Workaround

None - recompile

Works on UWP/WinUI

None

Environment

Other

NuGet package version(s)

Uno.Sdk - 5.6.20, 5.6.22, 5.6.45

Affected platforms

Android

IDE

Rider macOS

IDE version

2024.3.6

Relevant plugins

No response

Anything else we need to know?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions