Describe the bug
This test fails for the single-file, RID-specific publish because the single-file apphost is locked when we try to take a file read:
TestPublishItemsOutputGroupOutputs failed with 1 error(s) (4.2s) → TestPublishItemsOutputGroupOutputs/bin/Debug/net6.0/win-x86/TestPublishItemsOutputGroupOutputs.dll
/workspaces/sdk/artifacts/bin/redist/Debug/dotnet/sdk/10.0.100-dev/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1132,5): error MSB4018: The "GenerateBundle" task failed unexpectedly.
System.IO.IOException: The process cannot access the file '/workspaces/sdk/artifacts/tmp/Debug/testing/RunPublishIte---00D00966/TestPublishItemsOutputGroupOutputs/obj/Debug/net6.0/win-x86/singlefilehost.exe' 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.OpenRead(String path) at Microsoft.NET.HostModel.Bundle.Bundler.GenerateBundle(IReadOnlyList`1 fileSpecs) at Microsoft.NET.Build.Tasks.GenerateBundle.ExecuteCore() in /workspaces/sdk/src/Tasks/Microsoft.NET.Build.Tasks/GenerateBundle.cs:line 81 at Microsoft.NET.Build.Tasks.TaskBase.Execute() in /workspaces/sdk/src/Tasks/Common/TaskBase.cs:line 36 at Microsoft.Build.BackEnd.TaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
The GenerateBundle task in question is calling into the runtime-provided APIs for making the single-file apphost for this project, and as part of that a File.OpenRead cannot be taken.
Describe the bug
This test fails for the single-file, RID-specific publish because the single-file apphost is locked when we try to take a file read:
The
GenerateBundletask in question is calling into the runtime-provided APIs for making the single-file apphost for this project, and as part of that a File.OpenRead cannot be taken.