Skip to content

Race condition writing Microsoft.Interop.DllImportGenerator.dll during library product build (Windows x64 Release) #61687

@trylek

Description

@trylek

Example run: https://dev.azure.com/dnceng/public/_build/results?buildId=1472395&view=logs&j=3ee9f22f-fdeb-5ba9-4d07-86b7b8a7437b&t=796c5bee-4d73-5a57-e6ab-2038dda597c4

Observed on platform: Windows x64 Release (the failure is apparently non-deterministic so it may also repro on other platforms)

Diagnostic output:

  System.Private.CoreLib.Generators -> D:\a\_work\1\s\artifacts\bin\System.Private.CoreLib.Generators\netstandard2.0-Release\System.Private.CoreLib.Generators.dll
  Microsoft.Interop.SourceGeneration -> D:\a\_work\1\s\artifacts\bin\Microsoft.Interop.SourceGeneration\netstandard2.0-Release\Microsoft.Interop.SourceGeneration.dll
CSC : error CS2012: Cannot open 'D:\a\_work\1\s\artifacts\obj\DllImportGenerator\netstandard2.0-Release\Microsoft.Interop.DllImportGenerator.dll' for writing -- 'The process cannot access the file 'D:\a\_work\1\s\artifacts\obj\DllImportGenerator\netstandard2.0-Release\Microsoft.Interop.DllImportGenerator.dll' because it is being used by another process.' [D:\a\_work\1\s\src\libraries\System.Runtime.InteropServices\gen\DllImportGenerator\DllImportGenerator.csproj]
##[error]CSC(0,0): error CS2012: (NETCORE_ENGINEERING_TELEMETRY=Build) Cannot open 'D:\a\_work\1\s\artifacts\obj\DllImportGenerator\netstandard2.0-Release\Microsoft.Interop.DllImportGenerator.dll' for writing -- 'The process cannot access the file 'D:\a\_work\1\s\artifacts\obj\DllImportGenerator\netstandard2.0-Release\Microsoft.Interop.DllImportGenerator.dll' because it is being used by another process.'
  DllImportGenerator -> D:\a\_work\1\s\artifacts\bin\DllImportGenerator\netstandard2.0-Release\Microsoft.Interop.DllImportGenerator.dll

Based on my past experience I would expect this to be caused by interlocking holes that cause two projects to try building the DllImportGenerator project in parallel but I'm not a library build expert. @jkoritzinsky, based on your experience with Roslyn generators, could you please suggest how to continue the investigation?

Thanks

Tomas

Metadata

Metadata

Assignees

Labels

area-Infrastructure-librariesblocking-clean-ciBlocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'untriagedNew issue has not been triaged by the area owner

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions