-
Notifications
You must be signed in to change notification settings - Fork 566
IOException in AssemblyModifierPipeline #11022
Copy link
Copy link
Open
Labels
Area: App+Library BuildIssues when building Library projects or Application projects.Issues when building Library projects or Application projects.needs-triageIssues that need to be assigned.Issues that need to be assigned.
Description
Android framework version
net10.0-android
Affected platform version
.NET 10.0.201
Description
When trying to build an Android MAUI app in a Windows container, the build fails with an IOException from AssemblyModifierPipeline
Steps to Reproduce
I will try and come up with a minimal repro, but I note that the SourceFiles parameter to AssemblyModifierPipeline includes duplicate entries, and it appears to perform write operations on files in the .nuget/packages directory e.g.
D:\.nuget\packages\microsoft.maui.controls.core\10.0.50\lib\net10.0-android36.0\ar\Microsoft.Maui.Controls.resources.dll
D:\.nuget\packages\microsoft.maui.controls.core\10.0.50\lib\net10.0-android36.0\ar\Microsoft.Maui.Controls.resources.dll
| File.SetLastWriteTimeUtc (destination.ItemSpec, DateTime.UtcNow); |
Inspecting those files does show that the file access times are indeed being modified.
Did you find any workaround?
Building on the host works OK, but not in a container.
Relevant log output
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\36.1.30\tools\Xamarin.Android.Common.targets(1501,3): error XAAMP7024: The file is locked by: "MSBuild.exe (3028)".
System.IO.IOException: The process cannot access the file 'C:\Users\ContainerUser\.nuget\packages\microsoft.maui.controls.core\10.0.50\lib\net10.0-android36.0\ar\Microsoft.Maui.Controls.resources.dll' because it is being used by another process.
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 Xamarin.Android.Tasks.SaveChangedAssemblyStep.ProcessAssembly(AssemblyDefinition assembly, StepContext context)
at Xamarin.Android.Tasks.AssemblyPipeline.Run(AssemblyDefinition assembly, StepContext context)
at Xamarin.Android.Tasks.AssemblyModifierPipeline.RunTask()
at Microsoft.Android.Build.Tasks.AndroidTask.Execute() [C:\src\project\App.csproj]Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area: App+Library BuildIssues when building Library projects or Application projects.Issues when building Library projects or Application projects.needs-triageIssues that need to be assigned.Issues that need to be assigned.