Uh oh!
There was an error while loading. Please reload this page.
Remove race condition from DllImportGenerator build - #61695
Conversation
We had a race condition in the DllImportGenerator build due to the workaround implemented for Roslyn 4.0 RC1's new assembly loading scheme. RC2 has a fix that should work to enable us to remove the workaround.
ghost
commented
Nov 16, 2021
Tagging subscribers to this area: @Anipik, @safern, @ViktorHofer Issue DetailsWe had a race condition in the DllImportGenerator build due to the workaround implemented for Roslyn 4.0 RC1's new assembly loading scheme. RC2 has a fix that should work to enable us to remove the workaround. Fixes #61687
|
jkoritzinsky
commented
Nov 16, 2021
It looks like the Roslyn bug that I was working around didn't get fixed until after the RC2 release, so this fix as-is depends on the 6.0 RTM SDK update. I'll try to figure out another fix that works in both VS and at the command line, but it might take a bit |
trylek
commented
Nov 16, 2021
I just checked on the [succeeding] leg I retried in the originally failing run and I clearly see in the log that the DllImportGenerator project gets built twice - perhaps it's a dumb idea but wouldn't it be possible to just somehow deduplicate this at the build script level? WindowsBase -> D:\a\_work\1\s\artifacts\bin\WindowsBase\net7.0-Release\WindowsBase.dll 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 DllImportGenerator -> D:\a\_work\1\s\artifacts\bin\DllImportGenerator\netstandard2.0-Release\Microsoft.Interop.DllImportGenerator.dll DllImportGenerator -> D:\a\_work\1\s\artifacts\bin\DllImportGenerator\netstandard2.0-Release\Microsoft.Interop.DllImportGenerator.dll System.Collections.Specialized -> D:\a\_work\1\s\artifacts\bin\System.Collections.Specialized\net7.0-Release\System.Collections.Specialized.dll System.Collections.NonGeneric -> D:\a\_work\1\s\artifacts\bin\System.Collections.NonGeneric\net7.0-Release\System.Collections.NonGeneric.dll |
jkoritzinsky
commented
Nov 16, 2021
We could try to deduplicate it, but we'd be relying on "private" MSBuild semantics in the implementation of ProjectReferences. |
… (GetTargetPath doesn't touch any files, so it shouldn't race). We'll fix this with the real solution once we update to the RTM sdk
jkoritzinsky
commented
Nov 16, 2021
I was able to hack something together that should work. It's not the cleanest, but since I'm going to remove the workaround next month, we should be fine. |
trylek
left a comment
There was a problem hiding this comment.
Looks great to my limited understanding, thanks for providing the stopgap fix!
jkoritzinsky
commented
Nov 17, 2021
There's still another race here apparently (just hit it locally). Back to the drawing board I guess. |
…n a new per-project folder side-by-side to avoid race conditions.
jkoritzinsky
commented
Nov 17, 2021
Got another design. This one should avoid the case that caused a race condition in my last attempt. |
trylek
commented
Nov 17, 2021
Sounds like a solid design for the temporary workaround, thanks Jeremy; LGTM to the extent of my still limited understanding of Roslyn generators (after all that's why I asked you to take an initial look in the first place). |
safern
left a comment
There was a problem hiding this comment.
LGTM, I'm glad this is just temporary 😄
MichalStrehovsky
commented
Nov 22, 2021
I just hit a race with what's in main right now. Clean enlistment/deleted artifacts, followed by Rolling back the commit associated with this pull request unblocked me. |
We had a race condition in the DllImportGenerator build due to the workaround implemented for Roslyn 4.0 RC1's new assembly loading scheme. RC2 has a fix that should work to enable us to remove the workaround.
Fixes#61687