fix(samples): isolate Razor compilation in CI - #11298
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The change is a scoped, low-risk CI mitigation applied only to the affected workflow job and is clearly documented for future removal.
Review effort: Lite
Findings: None
What changed in this PR
Mitigates intermittent Razor compilation failures in the documentation/samples CI job by disabling Tiered PGO via an environment variable, aligning with the documented workaround for the suspected runtime/JIT issue until the repo’s pinned SDK/runtime is updated.
Changes:
- Adds
DOTNET_TieredPGO=0at the job level for the “Build documentation projects and samples” workflow job. - Documents the linked tracking issue and removal criteria in the workflow comments.
| File | Description |
|---|---|
.github/workflows/docs.yml |
Sets a job-scoped environment variable to disable Tiered PGO to stabilize Razor compilation in CI for docs/samples. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Code coverage
Report-only conclusion: regressed. The current-main baseline is commit Coverage combines every CI test matrix job, including providers, CodeGen, .NET 8/10, Linux, Windows, and macOS, using canonical physical source and branch identities. The comparison remains report-only while normal line and branch variance is calibrated. Coverage details |
The documentation workflow intermittently corrupts Razor-generated sources in its long-lived compiler server, producing spurious RZ1021 and cascading C# errors in the ShoppingCart sample. The identical commit passed after the job restarted, matching the compiler-server corruption documented in dotnet/roslyn#85656 and dotnet/roslyn#85196.
DOTNET_TieredPGO=0is not sufficient evidence of resolution because dotnet/roslyn#85656 includes later recurrence reports with that setting active. This change instead adds an opt-inBuild-Samples.ps1switch which passesUseSharedCompilation=falseonly to the sample solution build. That bypasses the stateful compiler server for the affected Razor workload while preserving the standard sample compilation requirement. The CI job uses no-incremental builds and previously completed in under five minutes against a 45-minute timeout, leaving ample capacity for the isolated compiler processes.The runtime fix in dotnet/runtime#132631 is scheduled for 10.0.13. Once
global.jsonselects an SDK carrying runtime 10.0.13 or later, remove the switch and validate shared compilation across repeated pull-request and scheduled Documentation runs. If the Razor corruption recurs, restore the bounded switch and continue investigation with generated sources and binlogs against dotnet/roslyn#85656.Mitigates #11235