Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 23, 2026

  • Revert the previous workaround that just removed the assertion
  • Investigate root cause of the invariant violation
    • Found that NodeLoggingContext.LogProjectStarted(request, configuration) sets evaluationId = InvalidEvaluationId when configuration.IsCached is true or configuration.Project is null
    • BuildRequestConfiguration doesn't store EvaluationId separately - only gets it from ProjectInstance
    • When configuration is cached, the ProjectInstance may not be available, causing InvalidEvaluationId to be used
  • Determine the proper fix:
    • Option A: Store EvaluationId in BuildRequestConfiguration so it survives caching
    • Option B: Ensure evaluation events are forwarded correctly from TaskHost
    • Option C: If cached configs legitimately don't have evaluation IDs, document this and handle it gracefully in TerminalLogger
  • Implement the fix
  • Validate by building dotnet/roslyn with /mt flag
  • Create unit tests
  • Run code review and security scanning
Original prompt

This section details on the original issue you should resolve

<issue_title>Multithreaded build for roslyn crashes in TerminalLogger</issue_title>
<issue_description>### Issue Description

After resolving issue with WPF build, the Roslyn build still crashes

Steps to Reproduce

use a patched MSBuild with #12991

git clone https://github.com/dotnet/roslyn
dotnet build Roslyn.slnx /mt

Expected Behavior

builds roslyn correctly
(this works with TL disabled)

Actual Behavior

PS C:\Users\janprovaznik\dev\testing\roslyn> ....\msbuilds\msb1\artifacts\bin\bootstrap\core\dotnet.exe build .\Roslyn.slnx /mt /bl
Restore complete (31.4s)
RulesetToEditorconfigConverter net472 win-x86 succeeded (22.6s) → artifacts\bin\RulesetToEditorconfigConverter\Debug\net472\RulesetToEditorconfigConverter.exe
GenerateAnalyzerNuspec net10.0 succeeded (22.7s) → artifacts\bin\GenerateAnalyzerNuspec\Debug\net10.0\GenerateAnalyzerNuspec.dll
TestReferenceAssembly netstandard2.0 succeeded (4.8s) → artifacts\bin\TestReferenceAssembly\Debug\netstandard2.0\TestReferenceAssembly.dll
CSharpSyntaxGenerator netstandard2.0 succeeded (17.5s) → artifacts\bin\CSharpSyntaxGenerator\Debug\netstandard2.0\CSharpSyntaxGenerator.dll
Microsoft.Build.Tasks.CodeAnalysis.Sdk net472 succeeded (20.1s) → artifacts\bin\Microsoft.Build.Tasks.CodeAnalysis.Sdk\Debug\net472\Microsoft.Build.Tasks.CodeAnalysis.Sdk.dll
Metrics net472 win-x86 succeeded (37.6s) → artifacts\bin\Metrics\Debug\net472\Metrics.exe
Microsoft.CodeAnalysis.PublicApiAnalyzers netstandard2.0 succeeded (39.9s) → artifacts\bin\Microsoft.CodeAnalysis.PublicApiAnalyzers\Debug\netstandard2.0\Microsoft.CodeAnalysis.PublicApiAnalyzers.dll
Microsoft.CodeAnalysis.Analyzers netstandard2.0 succeeded (44.7s) → artifacts\bin\Microsoft.CodeAnalysis.Analyzers\Debug\netstandard2.0\Microsoft.CodeAnalysis.Analyzers.dll
Microsoft.CodeAnalysis.ResxSourceGenerator netstandard2.0 succeeded (40.2s) → artifacts\bin\Microsoft.CodeAnalysis.ResxSourceGenerator\Debug\netstandard2.0\Microsoft.CodeAnalysis.ResxSourceGenerator.dll
Microsoft.CodeAnalysis.BannedApiAnalyzers netstandard2.0 succeeded (45.0s) → artifacts\bin\Microsoft.CodeAnalysis.BannedApiAnalyzers\Debug\netstandard2.0\Microsoft.CodeAnalysis.BannedApiAnalyzers.dll
Microsoft.CodeAnalysis.AnalyzerUtilities netstandard2.0 succeeded (38.8s) → artifacts\bin\Microsoft.CodeAnalysis.AnalyzerUtilities\Debug\netstandard2.0\Microsoft.CodeAnalysis.AnalyzerUtilities.dll
Roslyn.Diagnostics.Analyzers netstandard2.0 succeeded (42.0s) → artifacts\bin\Roslyn.Diagnostics.Analyzers\Debug\netstandard2.0\Roslyn.Diagnostics.Analyzers.dll
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers netstandard2.0 succeeded (41.6s) → artifacts\bin\Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers\Debug\netstandard2.0\Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers.dll
Text.Analyzers netstandard2.0 succeeded (43.3s) → artifacts\bin\Text.Analyzers\Debug\netstandard2.0\Text.Analyzers.dll
Microsoft.Build.Tasks.CodeAnalysis net472 succeeded (20.2s) → artifacts\bin\Microsoft.Build.Tasks.CodeAnalysis\Debug\net472\Microsoft.Build.Tasks.CodeAnalysis.dll
Microsoft.CodeAnalysis.Debugging.Package netstandard2.0 succeeded (7.1s) → artifacts\bin\Microsoft.CodeAnalysis.Debugging.Package\Debug\netstandard2.0\Microsoft.CodeAnalysis.Debugging.Package.dll
Microsoft.CodeAnalysis.PooledObjects.Package netstandard2.0 succeeded (7.2s) → artifacts\bin\Microsoft.CodeAnalysis.PooledObjects.Package\Debug\netstandard2.0\Microsoft.CodeAnalysis.PooledObjects.Package.dll
Microsoft.CodeAnalysis.CSharp.BannedApiAnalyzers netstandard2.0 succeeded (9.8s) → artifacts\bin\Microsoft.CodeAnalysis.CSharp.BannedApiAnalyzers\Debug\netstandard2.0\Microsoft.CodeAnalysis.CSharp.BannedApiAnalyzers.dll
Microsoft.CodeAnalysis netstandard2.0 succeeded (40.3s) → artifacts\bin\Microsoft.CodeAnalysis\Debug\netstandard2.0\Microsoft.CodeAnalysis.dll
GenerateDocumentationAndConfigFiles net10.0 succeeded (52.0s) → artifacts\bin\GenerateDocumentationAndConfigFiles\Debug\net10.0\GenerateDocumentationAndConfigFiles.dll
Microsoft.CodeAnalysis.Contracts.Package net8.0 succeeded (9.0s) → artifacts\bin\Microsoft.CodeAnalysis.Contracts.Package\Debug\net8.0\Microsoft.CodeAnalysis.Contracts.Package.dll
Microsoft.CodeAnalysis.ResxSourceGenerator.VisualBasic netstandard2.0 succeeded (9.4s) → artifacts\bin\Microsoft.CodeAnalysis.ResxSourceGenerator.VisualBasic\Debug\netstandard2.0\Microsoft.CodeAnalysis.ResxSourceGenerator.VisualBasic.dll
Microsoft.CodeAnalysis.Collections.Package net10.0 succeeded (10.4s) → artifacts\bin\Microsoft.CodeAnalysis.Collections.Package\Debug\net10.0\Microsoft.CodeAnalysis.Collections.Package.dll
Microsoft.CodeAnalysis.ResxSourceGenerator.CSharp netstandard2.0 succeeded (10.8s) → artifacts\bin\Microsoft.CodeAnalysis.ResxSourceGenerator.CSharp\Debug\netstandard2.0\Microsoft.CodeAnalysis.ResxSourceGenerator.CSharp.dl...


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@dotnet-policy-service
Copy link
Contributor

Hello @@copilot, I noticed that you’re changing an .swr file or any file under src/Package/MSBuild.VSSetup.. Please make sure to validate this change by an experimental VS insertion. This is accomplished by pushing to an exp/* branch, which requires write permissions to this repo.

…aluation event

Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix multithreaded build crash in TerminalLogger for Roslyn Fix TerminalLogger crash when ProjectStarted arrives without prior evaluation event Jan 23, 2026
Copilot AI requested a review from JanProvaznik January 23, 2026 12:33
@JanProvaznik
Copy link
Member

apparently copilot runners are not powerful enough to do the required validation ☹️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multithreaded build for roslyn crashes in TerminalLogger

2 participants