Skip to content

[Bug]: Copy.DoCopyWithRetries logs warnings without a diagnostic code #9210

@RobSwDev

Description

@RobSwDev

Issue Description

See #9190 CI builds frequently fail with MSB3021: Access to the path xxx.dll is denied

I'm using the secret MSBUILDALWAYSRETRY environmental variable to mitigate lots of Copy conflicts that unexpectedly started occurring last month.

However, when this retry happens, a warning is logged without a diagnostic code.
This means that I cannot exclude this warning in our "strict" build that treats warnings as errors:

LogDiagnostic("Got {0} copying {1} to {2} and HR is {3}", e.ToString(), sourceFileState.Name, destinationFileState.Name, code);

I'm currently giving these arguments to MSBuild:
/WarnAsError /nowarn:"MSB3270;MSB3026;MSB3021" /maxcpucount:1
I'd like to add "LogDiagnostic" warnings to the /nowarn list, but without a diagnostic code, I cannot see how to do so.

We are building to a single directory, so nuget packages that are referenced by multiple projects tend to get written multiple times. But even building single threaded, I cannot seem to avoid conflicts.

Microsoft.Common.CurrentVersion.targets(5167,5): error : Got System.IO.IOException: The process cannot access the file 'F:\build\bin\AnyCPU\Release\net472\libcef.dll' because it is being used by another process.
Microsoft.Common.CurrentVersion.targets(5167,5): error :    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
Microsoft.Common.CurrentVersion.targets(5167,5): error :    at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
Microsoft.Common.CurrentVersion.targets(5167,5): error :    at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
Microsoft.Common.CurrentVersion.targets(5167,5): error :    at Microsoft.Build.Tasks.Copy.CopyFileWithLogging(FileState sourceFileState, FileState destinationFileState)
Microsoft.Common.CurrentVersion.targets(5167,5): error :    at Microsoft.Build.Tasks.Copy.DoCopyWithRetries(FileState sourceFileState, FileState destinationFileState, CopyFileWithState copyFile) copying d:\Nuget\packages\cef.redist.x64\103.0.9\CEF\libcef.dll to F:\build\bin\AnyCPU\Release\net472\libcef.dll and HR is -2147024864

Steps to Reproduce

Unable to provide steps to reproduce, as I don't know what changed in our build environment (around the 10th August) that causes so many Copy File conflicts.

Expected Behavior

Ideally, warnings should include a diagnostic code.

Actual Behavior

Warning does not currently include a diagnostic code.

Analysis

No response

Versions & Configurations

No response

Metadata

Metadata

Assignees

Labels

Priority:1Work that is critical for the release, but we could probably ship withoutbugtriaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions