8000 dotnet watch fails with large solutions due to locked files. · Issue #49115 · dotnet/sdk · GitHub
[go: up one dir, main page]

Skip to content
dotnet watch fails with large solutions due to locked files. #49115
Open
@Iansa9

Description

@Iansa9

Describe the bug

Running dotnet watch build --project .\MySolution.sln on a solution with ~30 projects and ~50k lines of code fails to compile due to a file being locked by the same process.

To Reproduce

I couldn't reproduce it through a minimal sample as my suspicion is due to a race condition with large projects. Also, running the command multiple times yields different number of projects that failed with the same exception, so the failure is non-deterministic.

Exceptions (if any)

dotnet watch ⌚           dotnet watch ⌚    Build FAILED.
dotnet watch ⌚           "D:\Repo\MySolution.sln" (GenerateWatchList target) (1) ->
dotnet watch ⌚           "D:\Repo\ChildProject\ChildProject.csproj" (GenerateWatchList target) (17) ->
dotnet watch ⌚           (GenerateWatchList target) ->
dotnet watch ⌚             C:\Program Files\dotnet\sdk\8.0.410\DotnetTools\dotnet-watch\8.0.410-servicing.25266.33\tools\net8.0\any\DotNetWatch.targets(20,5): error MSB4018: The "FileSetSerializer" task failed unexpectedly. [D:\Repo\ChildProject\ChildProject.csproj]
dotnet watch ⌚           C:\Program Files\dotnet\sdk\8.0.410\DotnetTools\dotnet-watch\8.0.410-servicing.25266.33\tools\net8.0\any\DotNetWatch.targets(20,5): error MSB4018: System.IO.IOException: The process cannot access the file 'C:\Users\user\AppData\Local\Temp\tmp43s5ay.tmp' because it is being used by another process. [D:\Repo\ChildProject\ChildProject.csproj]
dotnet watch ⌚           C:\Program Files\dotnet\sdk\8.0.410\DotnetTools\dotnet-watch\8.0.410-servicing.25266.33\tools\net8.0\any\DotNetWatch.targets(20,5): error MSB4018:    at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) [D:\Repo\ChildProject\ChildProject.csproj]
dotnet watch ⌚           C:\Program Files\dotnet\sdk\8.0.410\DotnetTools\dotnet-watch\8.0.410-servicing.25266.33\tools\net8.0\any\DotNetWatch.targets(20,5): error MSB4018:    at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode) [D:\Repo\ChildProject\ChildProject.csproj]
dotnet watch ⌚           C:\Program Files\dotnet\sdk\8.0.410\DotnetTools\dotnet-watch\8.0.410-servicing.25266.33\tools\net8.0\any\DotNetWatch.targets(20,5): error MSB4018:    at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode) [D:\Repo\ChildProject\ChildProject.csproj]
dotnet watch ⌚           C:\Program Files\dotnet\sdk\8.0.410\DotnetTools\dotnet-watch\8.0.410-servicing.25266.33\tools\net8.0\any\DotNetWatch.targets(20,5): error MSB4018:    at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode) [D:\Repo\ChildProject\ChildProject.csproj]
dotnet watch ⌚           C:\Program Files\dotnet\sdk\8.0.410\DotnetTools\dotnet-watch\8.0.410-servicing.25266.33\tools\net8.0\any\DotNetWatch.targets(20,5): error MSB4018:    at System.IO.File.Create(String path) [D:\Repo\ChildProject\ChildProject.csproj]
dotnet watch ⌚           C:\Program Files\dotnet\sdk\8.0.410\DotnetTools\dotnet-watch\8.0.410-servicing.25266.33\tools\net8.0\any\DotNetWatch.targets(20,5): error MSB4018:    at DotNetWatchTasks.FileSetSerializer.Execute() [D:\Repo\ChildProject\ChildProject.csproj]
dotnet watch ⌚           C:\Program Files\dotnet\sdk\8.0.410\DotnetTools\dotnet-watch\8.0.410-servicing.25266.33\tools\net8.0\any\DotNetWatch.targets(20,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Execute() [D:\Repo\ChildProject\ChildProject.csproj]
dotnet watch ⌚           C:\Program Files\dotnet\sdk\8.0.410\DotnetTools\dotnet-watch\8.0.410-servicing.25266.33\tools\net8.0\any\DotNetWatch.targets(20,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [D:\Repo\ChildProject\ChildProject.csproj] 

Further technical details

  • Include the output of dotnet --info
    .NET SDK:
    Version: 8.0.410
    Commit: 0c2bff86e8
    Workload version: 8.0.400-manifests.5d19dc53
    MSBuild version: 17.11.31+933b72e36

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.410\

.NET workloads installed:
Configured to use loose manifests when installing new manifests.
[aspire]
Installation Source: VS 17.13.36105.23, VS 17.14.36025.13
Manifest Version: 8.2.2/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json
Install Type: FileBased

Host:
Version: 9.0.5
Architecture: x64
Commit: e36e4d1a8f

.NET SDKs installed:
8.0.410 [C:\Program Files\dotnet\sdk]
9.0.204 [C:\Program Files\dotnet\sdk]
9.0.300-preview.0.25177.5 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
D:\Repo\global.json

  • The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
    vscode 1.100.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0