Skip to content

aspire update hides restore errors caused by a lingering MSBuild task DLL lock #22352

Closed

Description

Is there an existing issue for this?

  • I have searched the existing issues.

Describe the bug

On Windows, aspire update --channel staging failed while upgrading an AppHost from Aspire 13.5.3 to 17.0.0. The CLI reported only:

Failed to restore packages for project C:\Development\Source\Contoso\Src\Contoso.AppHost\Contoso.AppHost.csproj after update.

The debug log recorded the restore process exiting with code 1, but did not include its stdout/stderr or the underlying NuGet error. The Aspire CLI exited with code 13.

Reproducing the upgraded restore using disposable copies of the project files exposed the actual error:

C:\Program Files\dotnet\sdk\10.0.404\NuGet.targets(198,5): error : Access to the path 'Aspire.Hosting.Tasks.dll' is denied.

This was caused by a surviving MSBuild worker holding the task DLL loaded after the AppHost had been stopped. aspire ps no longer reported the affected AppHost running. The worker's ownership has not been established; it may be a reusable build worker or IDE/design-time process, rather than an Aspire-managed runtime resource.

All application names and application paths in this report have been replaced with Contoso.

Expected Behavior

  • When the post-update restore fails, display the underlying restore diagnostics, and include them in the CLI log, rather than reporting only a generic restore failure.
  • If Aspire owns the surviving build worker, investigate releasing its task-assembly locks when the AppHost is stopped. If the worker is intentionally shared or IDE-owned, clarify that boundary rather than indiscriminately terminating shared build processes.

Steps To Reproduce

Observed sequence:

  1. Use a Windows AppHost with a repository-local staging package cache at Src\.nugetpackages.

  2. Run the AppHost and then stop it. Confirm the affected AppHost is no longer listed by aspire ps.

  3. An MSBuild worker remains with this exact assembly loaded:

    C:\Development\Source\Contoso\Src\.nugetpackages\aspire.hosting.apphost\17.0.0\tools\net10.0\Aspire.Hosting.Tasks.dll
    
  4. Before the local cache was ignored by Git, run git clean -fd. Git removes the other untracked package files but cannot unlink the loaded DLL:

    Unlink of file 'Src/.nugetpackages/aspire.hosting.apphost/17.0.0/tools/net10.0/Aspire.Hosting.Tasks.dll' failed. Should I try again? (y/n) n
    warning: failed to remove Src/.nugetpackages/aspire.hosting.apphost/17.0.0/tools/net10.0/Aspire.Hosting.Tasks.dll: Invalid argument
    
  5. Run aspire update --channel staging and accept the proposed 13.5.3 -> 17.0.0 package updates and NuGet configuration changes.

  6. The post-update restore attempts to replace the incomplete cached package, fails on the locked DLL, and the CLI shows only the generic error above.

The cached Aspire.Hosting.AppHost/17.0.0 directory was inspected afterward: only its tools directory remained. Replaying a locally captured restore binlog confirmed that NuGet failed while deleting this incomplete package installation before reinstalling it.

The exact mechanism that originally created the lingering MSBuild worker has not yet been reduced to a standalone repro. No successful retry after shutting down that worker has been verified.

Exceptions (if any)

CLI exception:

Aspire.Cli.Projects.ProjectUpdaterException: Failed to restore packages for project C:\Development\Source\Contoso\Src\Contoso.AppHost\Contoso.AppHost.csproj after update.

Underlying exception from the reproduced restore binlog:

System.UnauthorizedAccessException: Access to the path 'Aspire.Hosting.Tasks.dll' is denied.
   at System.IO.FileSystem.RemoveDirectoryRecursive(String fullPath, WIN32_FIND_DATA& findData, Boolean topLevel)
   at System.IO.FileSystem.RemoveDirectory(String fullPath, Boolean recursive)
   at System.IO.DirectoryInfo.Delete(Boolean recursive)
   at NuGet.Packaging.PackageExtractor.<>c__DisplayClass6_0.<<InstallFromSourceAsync>b__0>d.MoveNext()

Anything else?

  • OS: Windows.

  • Development environment: VS Code and Aspire CLI.

  • Aspire CLI: 17.0.0+148071e36dbb16c1cad260dedec2496871b6f49a.

  • Aspire CLI build ID: 17.0.26.56603.

  • CLI/update channel: staging.

  • AppHost target framework: net10.0.

  • Restore used .NET SDK 10.0.404.

  • The process confirmed to have the exact DLL loaded was MSBuild.exe, PID 45424, with command line:

    "C:\Program Files\dotnet\sdk\11.0.100\MSBuild.exe" /nologo /nodemode:8
    

The CLI logging gap appears to be in ProjectUpdater.UpdateProjectAsync: the call to runner.RestoreAsync supplies NuGetRestoreTargetsFile but no stdout/stderr callbacks, then throws a generic ProjectUpdaterException on a nonzero exit code. The runner forwards output to the supplied callbacks, so the actionable restore error is lost on this path. Capturing and surfacing failed-restore output would make this substantially easier to diagnose.

Raw logs and binlogs are intentionally not attached because they contain environment-specific feed configuration. The excerpts above are sanitized.

Activity

  1. added
    needs-area-label
    on Nov 17, 2026
  2. joperezr commented on Nov 17, 2026

    @joperezr
    Member
    🤖 Aspire triage pass — 2026-11-17 01:10 UTC

    Area: area-cli
    Kind: bug
    Repro: partial — observed sequence and reproduction limitations are described in lines 31–61 of the issue body; no standalone worker-creation repro or successful recovery is established
    Affected version(s): staging CLI 17.0.0, build 17.0.26.56603; attempted AppHost update from 13.5.3 to 17.0.0 (last working: not established; latest published release: 13.6.5)
    Severity: S3 — failed-restore diagnostics are missing in a Windows staging update involving an incomplete package cache; broad impact and Aspire ownership of the locking worker are unconfirmed

    Urgency: ⚪ backlog — no milestone
    Reason: actionable diagnostics report, but current evidence describes an edge scenario and does not establish a regression, broad impact, or sufficient priority for the configured active train

    Suggested owner(s): pending human availability check — highest-scoring candidate is davidfowl (score 73 within bounded samples); no ping because GitHub status could not be verified within repository-scoped queries
    Evidence:

    Confidence: medium
    Needs human?: yes — reconcile stale release-routing configuration, verify candidate availability, and establish worker ownership and a standalone reproduction before lifecycle changes

  3. added
    triage:bot-seen
    triage:needs-human
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-clineeds-area-labeltriage:bot-seentriage:needs-human

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions