Introduce analyzer or some other mechanism to flag builds that invoke the compiler (i.e. CoreCompile target) with same inputs and outputs to avoid race conditions
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
Similar to https://github.com/dotnet/msbuild/issues/9553
https://github.com/dotnet/command-line-api/pull/2336 is a good example to talk about the issue. `System.CommandLine.csproj` was built twice because two additional global properties were passed in when referencing it from a specific test project. The global properties didn't affect the CoreCompile target and the compiled output at all. This resulted in a race condition as two processes were trying to copy to the same output at the same time:
> MSB4018: System.IO.IOException: The process cannot access the file '/vmr/src/command-line-api/artifacts/bin/System.CommandLine/Release/net7.0/System.CommandLine.deps.json' because it is being used by another process. [/vmr/src/command-line-api/src/System.CommandLine/System.CommandLine.csproj::TargetFramework=net7.0]
99% of the time this is unintentional and it would be great if msbuild could flag that somehow via an analyzer or some other means.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.