Cancelling static graph-based restore does not end the restore process #13140
Labels
Area:RestoreStaticGraph
Issues related to the Static Graph restore
Priority:2
Issues for the current backlog.
Type:Bug
Milestone
NuGet Product Used
MSBuild.exe, dotnet.exe
Product Version
All
Worked before?
No response
Impact
It bothers me. A fix would be nice
Repro Steps & Context
Static graph-based restore launches an external process and waits for it to return:
https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Build.Tasks/StaticGraphRestoreTaskBase.cs#L184
However, the code passes a cancellation token which is fired when the user cancels a build via CTRL+C. The
catch
code is there to returntrue
so that cancelled builds don't "fail" but it does not kill the process.https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Build.Tasks/StaticGraphRestoreTaskBase.cs#L211-L217
The
try...catch
which handles cancellation should be moved to surround just theSemaphore.Wait()
since that's the only call that would throw anOperationCanceledException
. The proceeding code would then kill the process and returntrue
in the case where the user canceled the build.Verbose Logs
No response
The text was updated successfully, but these errors were encountered: