Skip to content

MSB4220: Waiting for the currently executing task "Copy" to cancel #9000

Open
@bhalchandratk

Description

@bhalchandratk

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I can reproduce the issue - Build won't finish dotnet/extensions#1406 ( dotnet/sdk#9034 ) . This issue is still not fixed. Today I have installed fresh copy of VS 2022 version 17.5.1 Professional (64-bit) licensed edition in my organization computer. I was observing this issue for last 15 days recurrently and it was wasting my time like anything. Today i used process explorer to monitor what is going wrong and also started build using commandline dotnet build command with detailed logged enabled.

My observations are -

  • Build keeps executing CopyToOutputDirectory action to copy apphost.exe from obj folder to bin folder for infinite amount of time. We cancel the build by Build -> Cancel option or control+c then onwards MSBuild stuck infite with error - MSB4220: Waiting for the currently executing task "Copy" to cancel. [ project name ].
  • There are 3 MSBuild.exe running. First cancel stops/kills 1 MSBuild.exe
  • 2 MSBuild.exe still running and then error starts coming on screen - MSB4220: Waiting for the currently executing task "Copy" to cancel

project type - asp.net core web api
.net version - 6.0 sdk
VS version - VS 2022 version 17.5.1

Expected Behavior

Build should not hang if it fails to copy the files, there should be some timeout and then throw exception notifying user of details. Right now i let it wait and build keeps waiting for hours ( i let it run overright and checked in the morning, it was still waiting for the copy operation to finish).

Steps To Reproduce

I can reproduce the issue - Build won't finish dotnet/extensions#1406 ( dotnet/sdk#9034 ) . This issue is still not fixed. Today I have installed fresh copy of VS 2022 version 17.5.1 Professional (64-bit) licensed edition in my organization computer. I was observing this issue for last 15 days recurrently and it was wasting my time like anything. Today i used process explorer to monitor what is going wrong and also started build using commandline dotnet build command with detailed logged enabled.

My observations are -

  • Build keeps executing CopyToOutputDirectory action to copy apphost.exe from obj folder to bin folder for infinite amount of time. We cancel the build by Build -> Cancel option or control+c then onwards MSBuild stuck infite with error - MSB4220: Waiting for the currently executing task "Copy" to cancel. [ project name ].
  • There are 3 MSBuild.exe running. First cancel stops/kills 1 MSBuild.exe
  • 2 MSBuild.exe still running and then error starts coming on screen - MSB4220: Waiting for the currently executing task "Copy" to cancel

project type - asp.net core web api
.net version - 6.0 sdk
VS version - VS 2022 version 17.5.1

Exceptions (if any)

No response

.NET Version

6.0

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: TasksIssues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll.Priority:3Work that is nice to haveneeds-designRequires discussion with the dev team before attempting a fix.triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions