Migrate JitOptimizationSensitive and GCStressIncompatible to SkipOnCoreClr attributes - #126108

Merged
jkoritzinsky merged 30 commits into
mainfrom
copilot/update-requirements-for-requiresprocessisolation
Jul 27, 2026
Merged

Migrate JitOptimizationSensitive and GCStressIncompatible to SkipOnCoreClr attributes#126108
jkoritzinsky merged 30 commits into
mainfrom
copilot/update-requirements-for-requiresprocessisolation

Conversation

CopilotAI commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Replaces eligible MSBuild <JitOptimizationSensitive> and <GCStressIncompatible> properties with [SkipOnCoreClr(...)] applied directly to test entry points, moving skip logic from build-time property injection into the XUnit test runner where the test can safely run without process isolation.

Description

Why

MSBuild properties like <GCStressIncompatible> and <JitOptimizationSensitive> require <RequiresProcessIsolation>true</RequiresProcessIsolation> to take effect — process isolation is expensive. Moving eligible skips to XUnit attributes allows tests to be skipped in-process without spawning a new process per test. Tests that still require process isolation for other reasons retain <RequiresProcessIsolation>true</RequiresProcessIsolation>.

Changes

JitOptimizationSensitive — ilproj tests (4 .il files, 4 .ilproj files)

  • Added SkipOnCoreClrAttribute with AnyJitOptimizationStress (0x11E) to each IL entry point
  • Added .assembly extern Microsoft.DotNet.XUnitExtensions where missing
  • Removed <JitOptimizationSensitive> and sole-cause <RequiresProcessIsolation> from project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to project files that were missing it

GCStressIncompatible — all project types (~310 files total)

C# (150 .cs + 150 .csproj):

  • Added [SkipOnCoreClr("This test is not compatible with GC stress.", RuntimeTestModes.AnyGCStress)] before each [Fact]/[Theory]/[ConditionalFact]/[ConditionalTheory]
  • Removed <GCStressIncompatible> and sole-cause <RequiresProcessIsolation> from project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to 65 csproj files that were missing it
  • Removed dangling <GCStressIncompatible> from project files where the compiled source already had a corresponding [SkipOnCoreClr(..., RuntimeTestModes.AnyGCStress)] attribute

IL (6 .ilproj, 3 .il):

  • 3 GenericContext tests: IL was pre-migrated; removed MSBuild properties from project files
  • 3 JIT regression tests: Added SkipOnCoreClrAttribute (0xC0 = AnyGCStress) to IL entry points; updated project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to 6 ilproj files that were missing it

F#:

  • Runtime_72845 was left on the standalone [<EntryPoint>]/exit-code pattern with <GCStressIncompatible>true</GCStressIncompatible> and <RequiresProcessIsolation>true</RequiresProcessIsolation> retained, because the attempted XUnit conversion did not compile in targeted test builds

HeapVerifyIncompatible — migrated tests

  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to project files that were missing it
  • For tests where <HeapVerifyIncompatible> was conditional on architecture, replaced the unconditional [SkipOnCoreClr(..., RuntimeTestModes.HeapVerify)] with [ConditionalFact] backed by a static bool property that combines the architecture check with TestLibrary.CoreClrConfigurationDetection.IsHeapVerify, preserving the original per-architecture skip semantics

Comment cleanup

  • Audited edited project files where <GCStressIncompatible> was removed and updated or removed stale RequiresProcessIsolation comments
  • Audited orphaned project comments that provided GC stress skip context, removed the orphaned comments, and moved important issue/context details into the corresponding [SkipOnCoreClr(...)] attribute messages
  • Kept remaining RequiresProcessIsolation rationale comments positioned above the <RequiresProcessIsolation> property they describe

Infrastructure and documentation

  • Doubled the browser-wasm (CoreCLR) runtime test work item timeout in helixpublishwitharcade.proj (123 → 246 minutes) to accommodate the larger merged test collections
  • Updated requiresprocessisolation.md to document two additional triggers for <RequiresProcessIsolation>: <IsLongRunningGCTest> and <CLRTestExecutionArguments>

CI failure fixes and process-isolation audit

  • Restored <RequiresProcessIsolation>true</RequiresProcessIsolation> to tests that still require isolation for GC measurement accuracy, long-running GC pre-commands, custom CLR test execution arguments, GC.WaitForPendingFinalizers, unsupported target handling, unloadability, NativeAOT incompatibility, output-copying project references, or Process.Start
  • Added targeted [ActiveIssue] suppressions for CI failures on browser-wasm CoreCLR and Mono interpreter browser-wasm where appropriate
  • Resolved merge conflict in GetTotalAllocatedBytes.cs while preserving GC stress and HeapVerify skip behavior

Not migrated (MSBuild property retained)

  • Tests with ReferenceXUnitWrapperGenerator=false — no XUnit runner
  • Profiler tests — custom host runner with no XUnit
  • HW intrinsics wrapper projects — architecture-conditional property, no owned source
  • OutputType=Library projects — no entry point
  • Tests using top-level statements with no [Fact] method
  • Runtime_72845.fsproj — F# XUnit conversion did not compile in targeted test builds, so this test retains <GCStressIncompatible>true</GCStressIncompatible> and standalone process isolation
  • ReadyToRun tests with crossgen2 shell pre-commands (multifolder, determinism/crossgen2determinism) — [SkipOnCoreClr] only skips the XUnit test body, not pre-commands that run before the test executable
  • Tests that still match requiresprocessisolation.md rules retain <RequiresProcessIsolation>, including projects with CLRTestExecutionArguments, IsLongRunningGCTest, GC.WaitForPendingFinalizers, CLRTestTargetUnsupported, UnloadabilityIncompatible, NativeAotIncompatible, ProjectReference/content copying requirements, or Process.Start

CopilotAIand others added 7 commits March 24, 2026 21:57
…odes.HeapVerify)
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/b9ff7f11-db85-474b-bed1-1e4bd364f234
…ource files
Replace MSBuild property JitOptimizationSensitive with
[SkipOnCoreClr("This test is sensitive to JIT optimizations.", RuntimeTestModes.AnyJitOptimizationStress)]
attribute directly on [Fact]/[Theory] methods across 48 test source files.
Corresponding .csproj files have the <JitOptimizationSensitive> property removed.
RequiresProcessIsolation is also removed from project files where
JitOptimizationSensitive was the sole reason for it.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e migration
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/291e5882-a072-4964-8394-d20db497e472
…IL source files
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/e0266c53-b95c-4538-80c9-b7d881f45840
… ilproj, fsproj
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/66a86949-b520-4439-8d71-659f2b4391fc
…projects
- Remove GCStressIncompatible from 7 OutputType=Library projects where the
property is a no-op.
- Remove redundant conditional GCStressIncompatible from 10 X86 HWIntrinsics
projects (both arm64+osx and arm conditions already covered by
CLRTestTargetUnsupported).
- Remove redundant arm-only GCStressIncompatible from 2 Arm HWIntrinsics
projects (arm condition already covered by CLRTestTargetUnsupported).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add runtime HeapVerify check to ServerModel test using
CoreClrConfigurationDetection.IsHeapVerify (the last project using it).
- Remove HeapVerify skip logic from Batch and Bash execution script targets.
- Remove auto-setting of HeapVerifyIncompatible for disasm-check tests in
CLRTest.Jit.targets.
- Remove all documentation references to HeapVerifyIncompatible.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/gc
See info in area-owners.md if you want to be subscribed.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@MichalStrehovsky

Copy link
Copy Markdown
Member

Before we make more changes to the test tree, it would be nice to make the test tree buildable again. https://github.com/dotnet/runtime/runs/68503855882

I assume this is from #125460, I've seen similar failures when I worked on the Loader tree. It would be nice to re-validate we're still running the same number of tests after #125460, the validation at #125460 (comment) must have missed this.

@jkoritzinsky

Copy link
Copy Markdown
Member

I must have fat fingered the build command and missed the pri1 tests somehow. I'll fix that up before coming back to this.

@jkoritzinsky

Copy link
Copy Markdown
Member

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkoritzinsky

Copy link
Copy Markdown
Member

@copilot some of the projects you've edited still mention that they have RequiresProcessIsolation due to GCStressIncompatible. Please audit the projects you've edited to make sure that the reasons for a project being marked RPI are accurate.

… comments
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/c882c5b1-c293-4d09-8e31-17947a0bdd1e
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>

CopilotAI commented Apr 2, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot some of the projects you've edited still mention that they have RequiresProcessIsolation due to GCStressIncompatible. Please audit the projects you've edited to make sure that the reasons for...

Done in 48bc184. Audited all 78 project files where GCStressIncompatible was removed but the <!-- Needed for GCStressIncompatible, ... --> comment on RequiresProcessIsolation still referenced it. Updated each comment to reflect only the remaining reasons (e.g. UnloadabilityIncompatible, GC.WaitForPendingFinalizers, CMakeProjectReference, etc.). When GCStressIncompatible was the sole reason, the entire comment line was removed.

Comment threadsrc/tests/GC/API/GC/GetAllocatedBytesForCurrentThread.cs Outdated
Comment threadsrc/tests/GC/API/GC/GetGenerationWR2.csproj Outdated
Comment threadsrc/tests/GC/API/WeakReference/IsAlive.csproj Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/hugeexpr1.cs Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/HugeField2.cs Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/HugeField2.csproj Outdated
Comment threadsrc/tests/JIT/opt/Regressions/Regression2_Regressions.cs Outdated
Comment threadsrc/tests/JIT/Regression/JitBlue/DevDiv_255294/DevDiv_255294.csproj Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: dfcc4829-304a-4277-ac35-91ba6510eb70
CopilotAI review requested due to automatic review settings July 23, 2026 19:39

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@jkoritzinsky

Copy link
Copy Markdown
Member

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@jkoritzinsky

Copy link
Copy Markdown
Member

/ba-g no unknown failures but BA still red

@jkoritzinsky
jkoritzinsky enabled auto-merge (squash) July 27, 2026 17:12
@jkoritzinsky
jkoritzinsky merged commit c35b7ab into mainJul 27, 2026
144 of 150 checks passed
@jkoritzinsky
jkoritzinsky deleted the copilot/update-requirements-for-requiresprocessisolation branch July 27, 2026 17:12
@dotnet-milestone-botdotnet-milestone-botBot added this to the 11.0-rc1 milestone Jul 28, 2026
MichalStrehovsky added a commit that referenced this pull request Jul 30, 2026
MichalStrehovsky added a commit that referenced this pull request Jul 30, 2026
@EgorBo

Copy link
Copy Markdown
Member

@jkoritzinsky this seems like badly impacted outerloop CI

PR #126108 (c35b7ab, 2026-07-27 — matches the exact failure onset) migrated <JitOptimizationSensitive>/<GCStressIncompatible> MSBuild properties to [SkipOnCoreClr(...)] attributes. But
for tests with <RequiresProcessIsolation>true</RequiresProcessIsolation>, the generator emits an OutOfProcessTest that just runs the generated .cmd/.sh — xunit attributes on the entry
point are never inspected. So those tests lost their guard entirely

Example: #131447

@EgorBo

Copy link
Copy Markdown
Member

Ah, or was it fixed by #131670?

@jkoritzinsky

Copy link
Copy Markdown
Member

I fixed a particular test there where the rules for RPI were insufficient.

The case you linked that's still open may be due to the test being in il and the Main not being updated.

For IL tests, either reverting to the MSBuild properties or updating the Main method to call the methods on CoreClrConfigurationDetection would fix the issue.

EgorBo added a commit that referenced this pull request Aug 4, 2026
Fixes#131447.
## Root cause
Not a JIT bug. #126108 replaced the `<JitOptimizationSensitive>` and
`<GCStressIncompatible>` MSBuild properties with `[SkipOnCoreClr(...)]`
attributes on test entry points. That works for C# tests and for
in-process IL tests, but silently drops the guard for **IL tests that
also set `<RequiresProcessIsolation>`**:
| Test kind | What evaluates the skip | Result |
| --- | --- | --- |
| C#, any isolation | `GenerateStandaloneSimpleTestRunner` compiles the
check into `__GeneratedMainWrapper.Main` | ✅ honored |
| IL, in-process | merged runner reads the attribute from metadata via
`ExternallyReferencedTestMethodsVisitor` | ✅ honored |
| **IL + process isolation** | merged runner emits an `OutOfProcessTest`
that only calls `RunOutOfProcessTest(...)` on the generated run script,
and `ReferenceXUnitWrapperGenerator` is gated on `'$(Language)' == 'C#'`
so the IL assembly's hand-written `.entrypoint` never gets a wrapper
either | ❌ **nothing reads the attribute** |
In that last case only the MSBuild property puts the guard into the
generated `.cmd`/`.sh`.
`arrres_il_r` keeps its whole body in a single `Main`, so unoptimized
codegen (tier-0, minopts, JIT stress) keeps the `Test` objects alive in
untracked stack slots for the duration of `Main`. They are then never
finalized and never resurrected, and the test throws. It fails on every
default (tiered) run, which is why it lit up across outerloop, jitstress
and pgo on all platforms at once.
## Fix
Restore the MSBuild property on the two affected tests (option 1 from
#126108 (comment)):
- `arrres_il_r.ilproj` → `<JitOptimizationSensitive>`
- `b143840.ilproj` → `<GCStressIncompatible>` (same bug, unguarded on
gcstress legs; it kept `<RequiresProcessIsolation>` for
`<UnloadabilityIncompatible>`)
The `[SkipOnCoreClr]` attributes are intentionally left in place, so the
guard keeps working if either test ever stops requiring process
isolation. Each project gets a comment explaining why the property
cannot be dropped in favour of the attribute.
## Fallout audit
I enumerated all 16 IL tests carrying `[SkipOnCoreClr]` and evaluated
each owning project's *effective* `RequiresProcessIsolation` with
`msbuild -getProperty` (so inherited `Directory.Build.props`/`.targets`
values are accounted for). These two are the only process-isolated ones
— the other 14 are in-process and unaffected.
I also confirmed empirically, rather than by inspection alone, that both
of the "honored" rows above really do emit the guard, by disassembling
the built assemblies:
- `Directed_3.dll` (merged runner, in-process IL) contains `IsJitStress`
/ `IsJitStressRegs` / `IsJitMinOpts` / `IsTailCallStress` /
`IsTieredCompilation` checks guarding the call to
`[AttributeConflict]P::Main()`.
- `ObjectStackAllocationTests.dll` (process-isolated C#) contains the
same checks inside `__GeneratedMainWrapper`.
No C# test is affected by this class of bug.
## Validation
Built and ran the generated run scripts on windows-x64 checked:
```
arrres_il_r default (tiered) SKIP
TieredCompilation=0 PASS (Test passed., 100)
TC=0 + JITMinOpts=1 SKIP
TC=0 + JitStress=2 SKIP
b143840 default PASS
GCStress=0xC SKIP
```
Before the change, `arrres_il_r` reproduced the exact CI signature under
the default environment: unhandled `System.Exception` in
`GCTest_arrres_il.Test.Main`, exit `-532462766`.
cc @jkoritzinsky@jakobbotsch@JulieLeeMSFT
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a984328a-8b6c-4221-b2c9-d668eae5b505
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants

@MichalStrehovsky@jkoritzinsky@EgorBo
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Migrate JitOptimizationSensitive and GCStressIncompatible to SkipOnCoreClr attributes - #126108

Merged
jkoritzinsky merged 30 commits into
mainfrom
copilot/update-requirements-for-requiresprocessisolation
Jul 27, 2026
Merged

Migrate JitOptimizationSensitive and GCStressIncompatible to SkipOnCoreClr attributes#126108
jkoritzinsky merged 30 commits into
mainfrom
copilot/update-requirements-for-requiresprocessisolation

Conversation

CopilotAI commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Replaces eligible MSBuild <JitOptimizationSensitive> and <GCStressIncompatible> properties with [SkipOnCoreClr(...)] applied directly to test entry points, moving skip logic from build-time property injection into the XUnit test runner where the test can safely run without process isolation.

Description

Why

MSBuild properties like <GCStressIncompatible> and <JitOptimizationSensitive> require <RequiresProcessIsolation>true</RequiresProcessIsolation> to take effect — process isolation is expensive. Moving eligible skips to XUnit attributes allows tests to be skipped in-process without spawning a new process per test. Tests that still require process isolation for other reasons retain <RequiresProcessIsolation>true</RequiresProcessIsolation>.

Changes

JitOptimizationSensitive — ilproj tests (4 .il files, 4 .ilproj files)

  • Added SkipOnCoreClrAttribute with AnyJitOptimizationStress (0x11E) to each IL entry point
  • Added .assembly extern Microsoft.DotNet.XUnitExtensions where missing
  • Removed <JitOptimizationSensitive> and sole-cause <RequiresProcessIsolation> from project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to project files that were missing it

GCStressIncompatible — all project types (~310 files total)

C# (150 .cs + 150 .csproj):

  • Added [SkipOnCoreClr("This test is not compatible with GC stress.", RuntimeTestModes.AnyGCStress)] before each [Fact]/[Theory]/[ConditionalFact]/[ConditionalTheory]
  • Removed <GCStressIncompatible> and sole-cause <RequiresProcessIsolation> from project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to 65 csproj files that were missing it
  • Removed dangling <GCStressIncompatible> from project files where the compiled source already had a corresponding [SkipOnCoreClr(..., RuntimeTestModes.AnyGCStress)] attribute

IL (6 .ilproj, 3 .il):

  • 3 GenericContext tests: IL was pre-migrated; removed MSBuild properties from project files
  • 3 JIT regression tests: Added SkipOnCoreClrAttribute (0xC0 = AnyGCStress) to IL entry points; updated project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to 6 ilproj files that were missing it

F#:

  • Runtime_72845 was left on the standalone [<EntryPoint>]/exit-code pattern with <GCStressIncompatible>true</GCStressIncompatible> and <RequiresProcessIsolation>true</RequiresProcessIsolation> retained, because the attempted XUnit conversion did not compile in targeted test builds

HeapVerifyIncompatible — migrated tests

  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to project files that were missing it
  • For tests where <HeapVerifyIncompatible> was conditional on architecture, replaced the unconditional [SkipOnCoreClr(..., RuntimeTestModes.HeapVerify)] with [ConditionalFact] backed by a static bool property that combines the architecture check with TestLibrary.CoreClrConfigurationDetection.IsHeapVerify, preserving the original per-architecture skip semantics

Comment cleanup

  • Audited edited project files where <GCStressIncompatible> was removed and updated or removed stale RequiresProcessIsolation comments
  • Audited orphaned project comments that provided GC stress skip context, removed the orphaned comments, and moved important issue/context details into the corresponding [SkipOnCoreClr(...)] attribute messages
  • Kept remaining RequiresProcessIsolation rationale comments positioned above the <RequiresProcessIsolation> property they describe

Infrastructure and documentation

  • Doubled the browser-wasm (CoreCLR) runtime test work item timeout in helixpublishwitharcade.proj (123 → 246 minutes) to accommodate the larger merged test collections
  • Updated requiresprocessisolation.md to document two additional triggers for <RequiresProcessIsolation>: <IsLongRunningGCTest> and <CLRTestExecutionArguments>

CI failure fixes and process-isolation audit

  • Restored <RequiresProcessIsolation>true</RequiresProcessIsolation> to tests that still require isolation for GC measurement accuracy, long-running GC pre-commands, custom CLR test execution arguments, GC.WaitForPendingFinalizers, unsupported target handling, unloadability, NativeAOT incompatibility, output-copying project references, or Process.Start
  • Added targeted [ActiveIssue] suppressions for CI failures on browser-wasm CoreCLR and Mono interpreter browser-wasm where appropriate
  • Resolved merge conflict in GetTotalAllocatedBytes.cs while preserving GC stress and HeapVerify skip behavior

Not migrated (MSBuild property retained)

  • Tests with ReferenceXUnitWrapperGenerator=false — no XUnit runner
  • Profiler tests — custom host runner with no XUnit
  • HW intrinsics wrapper projects — architecture-conditional property, no owned source
  • OutputType=Library projects — no entry point
  • Tests using top-level statements with no [Fact] method
  • Runtime_72845.fsproj — F# XUnit conversion did not compile in targeted test builds, so this test retains <GCStressIncompatible>true</GCStressIncompatible> and standalone process isolation
  • ReadyToRun tests with crossgen2 shell pre-commands (multifolder, determinism/crossgen2determinism) — [SkipOnCoreClr] only skips the XUnit test body, not pre-commands that run before the test executable
  • Tests that still match requiresprocessisolation.md rules retain <RequiresProcessIsolation>, including projects with CLRTestExecutionArguments, IsLongRunningGCTest, GC.WaitForPendingFinalizers, CLRTestTargetUnsupported, UnloadabilityIncompatible, NativeAotIncompatible, ProjectReference/content copying requirements, or Process.Start

CopilotAIand others added 7 commits March 24, 2026 21:57
…odes.HeapVerify)
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/b9ff7f11-db85-474b-bed1-1e4bd364f234
…ource files
Replace MSBuild property JitOptimizationSensitive with
[SkipOnCoreClr("This test is sensitive to JIT optimizations.", RuntimeTestModes.AnyJitOptimizationStress)]
attribute directly on [Fact]/[Theory] methods across 48 test source files.
Corresponding .csproj files have the <JitOptimizationSensitive> property removed.
RequiresProcessIsolation is also removed from project files where
JitOptimizationSensitive was the sole reason for it.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e migration
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/291e5882-a072-4964-8394-d20db497e472
…IL source files
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/e0266c53-b95c-4538-80c9-b7d881f45840
… ilproj, fsproj
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/66a86949-b520-4439-8d71-659f2b4391fc
…projects
- Remove GCStressIncompatible from 7 OutputType=Library projects where the
property is a no-op.
- Remove redundant conditional GCStressIncompatible from 10 X86 HWIntrinsics
projects (both arm64+osx and arm conditions already covered by
CLRTestTargetUnsupported).
- Remove redundant arm-only GCStressIncompatible from 2 Arm HWIntrinsics
projects (arm condition already covered by CLRTestTargetUnsupported).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add runtime HeapVerify check to ServerModel test using
CoreClrConfigurationDetection.IsHeapVerify (the last project using it).
- Remove HeapVerify skip logic from Batch and Bash execution script targets.
- Remove auto-setting of HeapVerifyIncompatible for disasm-check tests in
CLRTest.Jit.targets.
- Remove all documentation references to HeapVerifyIncompatible.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/gc
See info in area-owners.md if you want to be subscribed.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@MichalStrehovsky

Copy link
Copy Markdown
Member

Before we make more changes to the test tree, it would be nice to make the test tree buildable again. https://github.com/dotnet/runtime/runs/68503855882

I assume this is from #125460, I've seen similar failures when I worked on the Loader tree. It would be nice to re-validate we're still running the same number of tests after #125460, the validation at #125460 (comment) must have missed this.

@jkoritzinsky

Copy link
Copy Markdown
Member

I must have fat fingered the build command and missed the pri1 tests somehow. I'll fix that up before coming back to this.

@jkoritzinsky

Copy link
Copy Markdown
Member

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkoritzinsky

Copy link
Copy Markdown
Member

@copilot some of the projects you've edited still mention that they have RequiresProcessIsolation due to GCStressIncompatible. Please audit the projects you've edited to make sure that the reasons for a project being marked RPI are accurate.

… comments
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/c882c5b1-c293-4d09-8e31-17947a0bdd1e
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>

CopilotAI commented Apr 2, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot some of the projects you've edited still mention that they have RequiresProcessIsolation due to GCStressIncompatible. Please audit the projects you've edited to make sure that the reasons for...

Done in 48bc184. Audited all 78 project files where GCStressIncompatible was removed but the <!-- Needed for GCStressIncompatible, ... --> comment on RequiresProcessIsolation still referenced it. Updated each comment to reflect only the remaining reasons (e.g. UnloadabilityIncompatible, GC.WaitForPendingFinalizers, CMakeProjectReference, etc.). When GCStressIncompatible was the sole reason, the entire comment line was removed.

Comment threadsrc/tests/GC/API/GC/GetAllocatedBytesForCurrentThread.cs Outdated
Comment threadsrc/tests/GC/API/GC/GetGenerationWR2.csproj Outdated
Comment threadsrc/tests/GC/API/WeakReference/IsAlive.csproj Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/hugeexpr1.cs Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/HugeField2.cs Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/HugeField2.csproj Outdated
Comment threadsrc/tests/JIT/opt/Regressions/Regression2_Regressions.cs Outdated
Comment threadsrc/tests/JIT/Regression/JitBlue/DevDiv_255294/DevDiv_255294.csproj Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: dfcc4829-304a-4277-ac35-91ba6510eb70
CopilotAI review requested due to automatic review settings July 23, 2026 19:39

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@jkoritzinsky

Copy link
Copy Markdown
Member

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@jkoritzinsky

Copy link
Copy Markdown
Member

/ba-g no unknown failures but BA still red

@jkoritzinsky
jkoritzinsky enabled auto-merge (squash) July 27, 2026 17:12
@jkoritzinsky
jkoritzinsky merged commit c35b7ab into mainJul 27, 2026
144 of 150 checks passed
@jkoritzinsky
jkoritzinsky deleted the copilot/update-requirements-for-requiresprocessisolation branch July 27, 2026 17:12
@dotnet-milestone-botdotnet-milestone-botBot added this to the 11.0-rc1 milestone Jul 28, 2026
MichalStrehovsky added a commit that referenced this pull request Jul 30, 2026
MichalStrehovsky added a commit that referenced this pull request Jul 30, 2026
@EgorBo

Copy link
Copy Markdown
Member

@jkoritzinsky this seems like badly impacted outerloop CI

PR #126108 (c35b7ab, 2026-07-27 — matches the exact failure onset) migrated <JitOptimizationSensitive>/<GCStressIncompatible> MSBuild properties to [SkipOnCoreClr(...)] attributes. But
for tests with <RequiresProcessIsolation>true</RequiresProcessIsolation>, the generator emits an OutOfProcessTest that just runs the generated .cmd/.sh — xunit attributes on the entry
point are never inspected. So those tests lost their guard entirely

Example: #131447

@EgorBo

Copy link
Copy Markdown
Member

Ah, or was it fixed by #131670?

@jkoritzinsky

Copy link
Copy Markdown
Member

I fixed a particular test there where the rules for RPI were insufficient.

The case you linked that's still open may be due to the test being in il and the Main not being updated.

For IL tests, either reverting to the MSBuild properties or updating the Main method to call the methods on CoreClrConfigurationDetection would fix the issue.

EgorBo added a commit that referenced this pull request Aug 4, 2026
Fixes#131447.
## Root cause
Not a JIT bug. #126108 replaced the `<JitOptimizationSensitive>` and
`<GCStressIncompatible>` MSBuild properties with `[SkipOnCoreClr(...)]`
attributes on test entry points. That works for C# tests and for
in-process IL tests, but silently drops the guard for **IL tests that
also set `<RequiresProcessIsolation>`**:
| Test kind | What evaluates the skip | Result |
| --- | --- | --- |
| C#, any isolation | `GenerateStandaloneSimpleTestRunner` compiles the
check into `__GeneratedMainWrapper.Main` | ✅ honored |
| IL, in-process | merged runner reads the attribute from metadata via
`ExternallyReferencedTestMethodsVisitor` | ✅ honored |
| **IL + process isolation** | merged runner emits an `OutOfProcessTest`
that only calls `RunOutOfProcessTest(...)` on the generated run script,
and `ReferenceXUnitWrapperGenerator` is gated on `'$(Language)' == 'C#'`
so the IL assembly's hand-written `.entrypoint` never gets a wrapper
either | ❌ **nothing reads the attribute** |
In that last case only the MSBuild property puts the guard into the
generated `.cmd`/`.sh`.
`arrres_il_r` keeps its whole body in a single `Main`, so unoptimized
codegen (tier-0, minopts, JIT stress) keeps the `Test` objects alive in
untracked stack slots for the duration of `Main`. They are then never
finalized and never resurrected, and the test throws. It fails on every
default (tiered) run, which is why it lit up across outerloop, jitstress
and pgo on all platforms at once.
## Fix
Restore the MSBuild property on the two affected tests (option 1 from
#126108 (comment)):
- `arrres_il_r.ilproj` → `<JitOptimizationSensitive>`
- `b143840.ilproj` → `<GCStressIncompatible>` (same bug, unguarded on
gcstress legs; it kept `<RequiresProcessIsolation>` for
`<UnloadabilityIncompatible>`)
The `[SkipOnCoreClr]` attributes are intentionally left in place, so the
guard keeps working if either test ever stops requiring process
isolation. Each project gets a comment explaining why the property
cannot be dropped in favour of the attribute.
## Fallout audit
I enumerated all 16 IL tests carrying `[SkipOnCoreClr]` and evaluated
each owning project's *effective* `RequiresProcessIsolation` with
`msbuild -getProperty` (so inherited `Directory.Build.props`/`.targets`
values are accounted for). These two are the only process-isolated ones
— the other 14 are in-process and unaffected.
I also confirmed empirically, rather than by inspection alone, that both
of the "honored" rows above really do emit the guard, by disassembling
the built assemblies:
- `Directed_3.dll` (merged runner, in-process IL) contains `IsJitStress`
/ `IsJitStressRegs` / `IsJitMinOpts` / `IsTailCallStress` /
`IsTieredCompilation` checks guarding the call to
`[AttributeConflict]P::Main()`.
- `ObjectStackAllocationTests.dll` (process-isolated C#) contains the
same checks inside `__GeneratedMainWrapper`.
No C# test is affected by this class of bug.
## Validation
Built and ran the generated run scripts on windows-x64 checked:
```
arrres_il_r default (tiered) SKIP
TieredCompilation=0 PASS (Test passed., 100)
TC=0 + JITMinOpts=1 SKIP
TC=0 + JitStress=2 SKIP
b143840 default PASS
GCStress=0xC SKIP
```
Before the change, `arrres_il_r` reproduced the exact CI signature under
the default environment: unhandled `System.Exception` in
`GCTest_arrres_il.Test.Main`, exit `-532462766`.
cc @jkoritzinsky@jakobbotsch@JulieLeeMSFT
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a984328a-8b6c-4221-b2c9-d668eae5b505
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants

@MichalStrehovsky@jkoritzinsky@EgorBo
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Migrate JitOptimizationSensitive and GCStressIncompatible to SkipOnCoreClr attributes - #126108

Merged
jkoritzinsky merged 30 commits into
mainfrom
copilot/update-requirements-for-requiresprocessisolation
Jul 27, 2026
Merged

Migrate JitOptimizationSensitive and GCStressIncompatible to SkipOnCoreClr attributes#126108
jkoritzinsky merged 30 commits into
mainfrom
copilot/update-requirements-for-requiresprocessisolation

Conversation

CopilotAI commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Replaces eligible MSBuild <JitOptimizationSensitive> and <GCStressIncompatible> properties with [SkipOnCoreClr(...)] applied directly to test entry points, moving skip logic from build-time property injection into the XUnit test runner where the test can safely run without process isolation.

Description

Why

MSBuild properties like <GCStressIncompatible> and <JitOptimizationSensitive> require <RequiresProcessIsolation>true</RequiresProcessIsolation> to take effect — process isolation is expensive. Moving eligible skips to XUnit attributes allows tests to be skipped in-process without spawning a new process per test. Tests that still require process isolation for other reasons retain <RequiresProcessIsolation>true</RequiresProcessIsolation>.

Changes

JitOptimizationSensitive — ilproj tests (4 .il files, 4 .ilproj files)

  • Added SkipOnCoreClrAttribute with AnyJitOptimizationStress (0x11E) to each IL entry point
  • Added .assembly extern Microsoft.DotNet.XUnitExtensions where missing
  • Removed <JitOptimizationSensitive> and sole-cause <RequiresProcessIsolation> from project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to project files that were missing it

GCStressIncompatible — all project types (~310 files total)

C# (150 .cs + 150 .csproj):

  • Added [SkipOnCoreClr("This test is not compatible with GC stress.", RuntimeTestModes.AnyGCStress)] before each [Fact]/[Theory]/[ConditionalFact]/[ConditionalTheory]
  • Removed <GCStressIncompatible> and sole-cause <RequiresProcessIsolation> from project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to 65 csproj files that were missing it
  • Removed dangling <GCStressIncompatible> from project files where the compiled source already had a corresponding [SkipOnCoreClr(..., RuntimeTestModes.AnyGCStress)] attribute

IL (6 .ilproj, 3 .il):

  • 3 GenericContext tests: IL was pre-migrated; removed MSBuild properties from project files
  • 3 JIT regression tests: Added SkipOnCoreClrAttribute (0xC0 = AnyGCStress) to IL entry points; updated project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to 6 ilproj files that were missing it

F#:

  • Runtime_72845 was left on the standalone [<EntryPoint>]/exit-code pattern with <GCStressIncompatible>true</GCStressIncompatible> and <RequiresProcessIsolation>true</RequiresProcessIsolation> retained, because the attempted XUnit conversion did not compile in targeted test builds

HeapVerifyIncompatible — migrated tests

  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to project files that were missing it
  • For tests where <HeapVerifyIncompatible> was conditional on architecture, replaced the unconditional [SkipOnCoreClr(..., RuntimeTestModes.HeapVerify)] with [ConditionalFact] backed by a static bool property that combines the architecture check with TestLibrary.CoreClrConfigurationDetection.IsHeapVerify, preserving the original per-architecture skip semantics

Comment cleanup

  • Audited edited project files where <GCStressIncompatible> was removed and updated or removed stale RequiresProcessIsolation comments
  • Audited orphaned project comments that provided GC stress skip context, removed the orphaned comments, and moved important issue/context details into the corresponding [SkipOnCoreClr(...)] attribute messages
  • Kept remaining RequiresProcessIsolation rationale comments positioned above the <RequiresProcessIsolation> property they describe

Infrastructure and documentation

  • Doubled the browser-wasm (CoreCLR) runtime test work item timeout in helixpublishwitharcade.proj (123 → 246 minutes) to accommodate the larger merged test collections
  • Updated requiresprocessisolation.md to document two additional triggers for <RequiresProcessIsolation>: <IsLongRunningGCTest> and <CLRTestExecutionArguments>

CI failure fixes and process-isolation audit

  • Restored <RequiresProcessIsolation>true</RequiresProcessIsolation> to tests that still require isolation for GC measurement accuracy, long-running GC pre-commands, custom CLR test execution arguments, GC.WaitForPendingFinalizers, unsupported target handling, unloadability, NativeAOT incompatibility, output-copying project references, or Process.Start
  • Added targeted [ActiveIssue] suppressions for CI failures on browser-wasm CoreCLR and Mono interpreter browser-wasm where appropriate
  • Resolved merge conflict in GetTotalAllocatedBytes.cs while preserving GC stress and HeapVerify skip behavior

Not migrated (MSBuild property retained)

  • Tests with ReferenceXUnitWrapperGenerator=false — no XUnit runner
  • Profiler tests — custom host runner with no XUnit
  • HW intrinsics wrapper projects — architecture-conditional property, no owned source
  • OutputType=Library projects — no entry point
  • Tests using top-level statements with no [Fact] method
  • Runtime_72845.fsproj — F# XUnit conversion did not compile in targeted test builds, so this test retains <GCStressIncompatible>true</GCStressIncompatible> and standalone process isolation
  • ReadyToRun tests with crossgen2 shell pre-commands (multifolder, determinism/crossgen2determinism) — [SkipOnCoreClr] only skips the XUnit test body, not pre-commands that run before the test executable
  • Tests that still match requiresprocessisolation.md rules retain <RequiresProcessIsolation>, including projects with CLRTestExecutionArguments, IsLongRunningGCTest, GC.WaitForPendingFinalizers, CLRTestTargetUnsupported, UnloadabilityIncompatible, NativeAotIncompatible, ProjectReference/content copying requirements, or Process.Start

CopilotAIand others added 7 commits March 24, 2026 21:57
…odes.HeapVerify)
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/b9ff7f11-db85-474b-bed1-1e4bd364f234
…ource files
Replace MSBuild property JitOptimizationSensitive with
[SkipOnCoreClr("This test is sensitive to JIT optimizations.", RuntimeTestModes.AnyJitOptimizationStress)]
attribute directly on [Fact]/[Theory] methods across 48 test source files.
Corresponding .csproj files have the <JitOptimizationSensitive> property removed.
RequiresProcessIsolation is also removed from project files where
JitOptimizationSensitive was the sole reason for it.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e migration
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/291e5882-a072-4964-8394-d20db497e472
…IL source files
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/e0266c53-b95c-4538-80c9-b7d881f45840
… ilproj, fsproj
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/66a86949-b520-4439-8d71-659f2b4391fc
…projects
- Remove GCStressIncompatible from 7 OutputType=Library projects where the
property is a no-op.
- Remove redundant conditional GCStressIncompatible from 10 X86 HWIntrinsics
projects (both arm64+osx and arm conditions already covered by
CLRTestTargetUnsupported).
- Remove redundant arm-only GCStressIncompatible from 2 Arm HWIntrinsics
projects (arm condition already covered by CLRTestTargetUnsupported).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add runtime HeapVerify check to ServerModel test using
CoreClrConfigurationDetection.IsHeapVerify (the last project using it).
- Remove HeapVerify skip logic from Batch and Bash execution script targets.
- Remove auto-setting of HeapVerifyIncompatible for disasm-check tests in
CLRTest.Jit.targets.
- Remove all documentation references to HeapVerifyIncompatible.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/gc
See info in area-owners.md if you want to be subscribed.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@MichalStrehovsky

Copy link
Copy Markdown
Member

Before we make more changes to the test tree, it would be nice to make the test tree buildable again. https://github.com/dotnet/runtime/runs/68503855882

I assume this is from #125460, I've seen similar failures when I worked on the Loader tree. It would be nice to re-validate we're still running the same number of tests after #125460, the validation at #125460 (comment) must have missed this.

@jkoritzinsky

Copy link
Copy Markdown
Member

I must have fat fingered the build command and missed the pri1 tests somehow. I'll fix that up before coming back to this.

@jkoritzinsky

Copy link
Copy Markdown
Member

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkoritzinsky

Copy link
Copy Markdown
Member

@copilot some of the projects you've edited still mention that they have RequiresProcessIsolation due to GCStressIncompatible. Please audit the projects you've edited to make sure that the reasons for a project being marked RPI are accurate.

… comments
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/c882c5b1-c293-4d09-8e31-17947a0bdd1e
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>

CopilotAI commented Apr 2, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot some of the projects you've edited still mention that they have RequiresProcessIsolation due to GCStressIncompatible. Please audit the projects you've edited to make sure that the reasons for...

Done in 48bc184. Audited all 78 project files where GCStressIncompatible was removed but the <!-- Needed for GCStressIncompatible, ... --> comment on RequiresProcessIsolation still referenced it. Updated each comment to reflect only the remaining reasons (e.g. UnloadabilityIncompatible, GC.WaitForPendingFinalizers, CMakeProjectReference, etc.). When GCStressIncompatible was the sole reason, the entire comment line was removed.

Comment threadsrc/tests/GC/API/GC/GetAllocatedBytesForCurrentThread.cs Outdated
Comment threadsrc/tests/GC/API/GC/GetGenerationWR2.csproj Outdated
Comment threadsrc/tests/GC/API/WeakReference/IsAlive.csproj Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/hugeexpr1.cs Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/HugeField2.cs Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/HugeField2.csproj Outdated
Comment threadsrc/tests/JIT/opt/Regressions/Regression2_Regressions.cs Outdated
Comment threadsrc/tests/JIT/Regression/JitBlue/DevDiv_255294/DevDiv_255294.csproj Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: dfcc4829-304a-4277-ac35-91ba6510eb70
CopilotAI review requested due to automatic review settings July 23, 2026 19:39

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@jkoritzinsky

Copy link
Copy Markdown
Member

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@jkoritzinsky

Copy link
Copy Markdown
Member

/ba-g no unknown failures but BA still red

@jkoritzinsky
jkoritzinsky enabled auto-merge (squash) July 27, 2026 17:12
@jkoritzinsky
jkoritzinsky merged commit c35b7ab into mainJul 27, 2026
144 of 150 checks passed
@jkoritzinsky
jkoritzinsky deleted the copilot/update-requirements-for-requiresprocessisolation branch July 27, 2026 17:12
@dotnet-milestone-botdotnet-milestone-botBot added this to the 11.0-rc1 milestone Jul 28, 2026
MichalStrehovsky added a commit that referenced this pull request Jul 30, 2026
MichalStrehovsky added a commit that referenced this pull request Jul 30, 2026
@EgorBo

Copy link
Copy Markdown
Member

@jkoritzinsky this seems like badly impacted outerloop CI

PR #126108 (c35b7ab, 2026-07-27 — matches the exact failure onset) migrated <JitOptimizationSensitive>/<GCStressIncompatible> MSBuild properties to [SkipOnCoreClr(...)] attributes. But
for tests with <RequiresProcessIsolation>true</RequiresProcessIsolation>, the generator emits an OutOfProcessTest that just runs the generated .cmd/.sh — xunit attributes on the entry
point are never inspected. So those tests lost their guard entirely

Example: #131447

@EgorBo

Copy link
Copy Markdown
Member

Ah, or was it fixed by #131670?

@jkoritzinsky

Copy link
Copy Markdown
Member

I fixed a particular test there where the rules for RPI were insufficient.

The case you linked that's still open may be due to the test being in il and the Main not being updated.

For IL tests, either reverting to the MSBuild properties or updating the Main method to call the methods on CoreClrConfigurationDetection would fix the issue.

EgorBo added a commit that referenced this pull request Aug 4, 2026
Fixes#131447.
## Root cause
Not a JIT bug. #126108 replaced the `<JitOptimizationSensitive>` and
`<GCStressIncompatible>` MSBuild properties with `[SkipOnCoreClr(...)]`
attributes on test entry points. That works for C# tests and for
in-process IL tests, but silently drops the guard for **IL tests that
also set `<RequiresProcessIsolation>`**:
| Test kind | What evaluates the skip | Result |
| --- | --- | --- |
| C#, any isolation | `GenerateStandaloneSimpleTestRunner` compiles the
check into `__GeneratedMainWrapper.Main` | ✅ honored |
| IL, in-process | merged runner reads the attribute from metadata via
`ExternallyReferencedTestMethodsVisitor` | ✅ honored |
| **IL + process isolation** | merged runner emits an `OutOfProcessTest`
that only calls `RunOutOfProcessTest(...)` on the generated run script,
and `ReferenceXUnitWrapperGenerator` is gated on `'$(Language)' == 'C#'`
so the IL assembly's hand-written `.entrypoint` never gets a wrapper
either | ❌ **nothing reads the attribute** |
In that last case only the MSBuild property puts the guard into the
generated `.cmd`/`.sh`.
`arrres_il_r` keeps its whole body in a single `Main`, so unoptimized
codegen (tier-0, minopts, JIT stress) keeps the `Test` objects alive in
untracked stack slots for the duration of `Main`. They are then never
finalized and never resurrected, and the test throws. It fails on every
default (tiered) run, which is why it lit up across outerloop, jitstress
and pgo on all platforms at once.
## Fix
Restore the MSBuild property on the two affected tests (option 1 from
#126108 (comment)):
- `arrres_il_r.ilproj` → `<JitOptimizationSensitive>`
- `b143840.ilproj` → `<GCStressIncompatible>` (same bug, unguarded on
gcstress legs; it kept `<RequiresProcessIsolation>` for
`<UnloadabilityIncompatible>`)
The `[SkipOnCoreClr]` attributes are intentionally left in place, so the
guard keeps working if either test ever stops requiring process
isolation. Each project gets a comment explaining why the property
cannot be dropped in favour of the attribute.
## Fallout audit
I enumerated all 16 IL tests carrying `[SkipOnCoreClr]` and evaluated
each owning project's *effective* `RequiresProcessIsolation` with
`msbuild -getProperty` (so inherited `Directory.Build.props`/`.targets`
values are accounted for). These two are the only process-isolated ones
— the other 14 are in-process and unaffected.
I also confirmed empirically, rather than by inspection alone, that both
of the "honored" rows above really do emit the guard, by disassembling
the built assemblies:
- `Directed_3.dll` (merged runner, in-process IL) contains `IsJitStress`
/ `IsJitStressRegs` / `IsJitMinOpts` / `IsTailCallStress` /
`IsTieredCompilation` checks guarding the call to
`[AttributeConflict]P::Main()`.
- `ObjectStackAllocationTests.dll` (process-isolated C#) contains the
same checks inside `__GeneratedMainWrapper`.
No C# test is affected by this class of bug.
## Validation
Built and ran the generated run scripts on windows-x64 checked:
```
arrres_il_r default (tiered) SKIP
TieredCompilation=0 PASS (Test passed., 100)
TC=0 + JITMinOpts=1 SKIP
TC=0 + JitStress=2 SKIP
b143840 default PASS
GCStress=0xC SKIP
```
Before the change, `arrres_il_r` reproduced the exact CI signature under
the default environment: unhandled `System.Exception` in
`GCTest_arrres_il.Test.Main`, exit `-532462766`.
cc @jkoritzinsky@jakobbotsch@JulieLeeMSFT
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a984328a-8b6c-4221-b2c9-d668eae5b505
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants

@MichalStrehovsky@jkoritzinsky@EgorBo
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Migrate JitOptimizationSensitive and GCStressIncompatible to SkipOnCoreClr attributes - #126108

Merged
jkoritzinsky merged 30 commits into
mainfrom
copilot/update-requirements-for-requiresprocessisolation
Jul 27, 2026
Merged

Migrate JitOptimizationSensitive and GCStressIncompatible to SkipOnCoreClr attributes#126108
jkoritzinsky merged 30 commits into
mainfrom
copilot/update-requirements-for-requiresprocessisolation

Conversation

CopilotAI commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Replaces eligible MSBuild <JitOptimizationSensitive> and <GCStressIncompatible> properties with [SkipOnCoreClr(...)] applied directly to test entry points, moving skip logic from build-time property injection into the XUnit test runner where the test can safely run without process isolation.

Description

Why

MSBuild properties like <GCStressIncompatible> and <JitOptimizationSensitive> require <RequiresProcessIsolation>true</RequiresProcessIsolation> to take effect — process isolation is expensive. Moving eligible skips to XUnit attributes allows tests to be skipped in-process without spawning a new process per test. Tests that still require process isolation for other reasons retain <RequiresProcessIsolation>true</RequiresProcessIsolation>.

Changes

JitOptimizationSensitive — ilproj tests (4 .il files, 4 .ilproj files)

  • Added SkipOnCoreClrAttribute with AnyJitOptimizationStress (0x11E) to each IL entry point
  • Added .assembly extern Microsoft.DotNet.XUnitExtensions where missing
  • Removed <JitOptimizationSensitive> and sole-cause <RequiresProcessIsolation> from project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to project files that were missing it

GCStressIncompatible — all project types (~310 files total)

C# (150 .cs + 150 .csproj):

  • Added [SkipOnCoreClr("This test is not compatible with GC stress.", RuntimeTestModes.AnyGCStress)] before each [Fact]/[Theory]/[ConditionalFact]/[ConditionalTheory]
  • Removed <GCStressIncompatible> and sole-cause <RequiresProcessIsolation> from project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to 65 csproj files that were missing it
  • Removed dangling <GCStressIncompatible> from project files where the compiled source already had a corresponding [SkipOnCoreClr(..., RuntimeTestModes.AnyGCStress)] attribute

IL (6 .ilproj, 3 .il):

  • 3 GenericContext tests: IL was pre-migrated; removed MSBuild properties from project files
  • 3 JIT regression tests: Added SkipOnCoreClrAttribute (0xC0 = AnyGCStress) to IL entry points; updated project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to 6 ilproj files that were missing it

F#:

  • Runtime_72845 was left on the standalone [<EntryPoint>]/exit-code pattern with <GCStressIncompatible>true</GCStressIncompatible> and <RequiresProcessIsolation>true</RequiresProcessIsolation> retained, because the attempted XUnit conversion did not compile in targeted test builds

HeapVerifyIncompatible — migrated tests

  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to project files that were missing it
  • For tests where <HeapVerifyIncompatible> was conditional on architecture, replaced the unconditional [SkipOnCoreClr(..., RuntimeTestModes.HeapVerify)] with [ConditionalFact] backed by a static bool property that combines the architecture check with TestLibrary.CoreClrConfigurationDetection.IsHeapVerify, preserving the original per-architecture skip semantics

Comment cleanup

  • Audited edited project files where <GCStressIncompatible> was removed and updated or removed stale RequiresProcessIsolation comments
  • Audited orphaned project comments that provided GC stress skip context, removed the orphaned comments, and moved important issue/context details into the corresponding [SkipOnCoreClr(...)] attribute messages
  • Kept remaining RequiresProcessIsolation rationale comments positioned above the <RequiresProcessIsolation> property they describe

Infrastructure and documentation

  • Doubled the browser-wasm (CoreCLR) runtime test work item timeout in helixpublishwitharcade.proj (123 → 246 minutes) to accommodate the larger merged test collections
  • Updated requiresprocessisolation.md to document two additional triggers for <RequiresProcessIsolation>: <IsLongRunningGCTest> and <CLRTestExecutionArguments>

CI failure fixes and process-isolation audit

  • Restored <RequiresProcessIsolation>true</RequiresProcessIsolation> to tests that still require isolation for GC measurement accuracy, long-running GC pre-commands, custom CLR test execution arguments, GC.WaitForPendingFinalizers, unsupported target handling, unloadability, NativeAOT incompatibility, output-copying project references, or Process.Start
  • Added targeted [ActiveIssue] suppressions for CI failures on browser-wasm CoreCLR and Mono interpreter browser-wasm where appropriate
  • Resolved merge conflict in GetTotalAllocatedBytes.cs while preserving GC stress and HeapVerify skip behavior

Not migrated (MSBuild property retained)

  • Tests with ReferenceXUnitWrapperGenerator=false — no XUnit runner
  • Profiler tests — custom host runner with no XUnit
  • HW intrinsics wrapper projects — architecture-conditional property, no owned source
  • OutputType=Library projects — no entry point
  • Tests using top-level statements with no [Fact] method
  • Runtime_72845.fsproj — F# XUnit conversion did not compile in targeted test builds, so this test retains <GCStressIncompatible>true</GCStressIncompatible> and standalone process isolation
  • ReadyToRun tests with crossgen2 shell pre-commands (multifolder, determinism/crossgen2determinism) — [SkipOnCoreClr] only skips the XUnit test body, not pre-commands that run before the test executable
  • Tests that still match requiresprocessisolation.md rules retain <RequiresProcessIsolation>, including projects with CLRTestExecutionArguments, IsLongRunningGCTest, GC.WaitForPendingFinalizers, CLRTestTargetUnsupported, UnloadabilityIncompatible, NativeAotIncompatible, ProjectReference/content copying requirements, or Process.Start

CopilotAIand others added 7 commits March 24, 2026 21:57
…odes.HeapVerify)
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/b9ff7f11-db85-474b-bed1-1e4bd364f234
…ource files
Replace MSBuild property JitOptimizationSensitive with
[SkipOnCoreClr("This test is sensitive to JIT optimizations.", RuntimeTestModes.AnyJitOptimizationStress)]
attribute directly on [Fact]/[Theory] methods across 48 test source files.
Corresponding .csproj files have the <JitOptimizationSensitive> property removed.
RequiresProcessIsolation is also removed from project files where
JitOptimizationSensitive was the sole reason for it.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e migration
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/291e5882-a072-4964-8394-d20db497e472
…IL source files
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/e0266c53-b95c-4538-80c9-b7d881f45840
… ilproj, fsproj
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/66a86949-b520-4439-8d71-659f2b4391fc
…projects
- Remove GCStressIncompatible from 7 OutputType=Library projects where the
property is a no-op.
- Remove redundant conditional GCStressIncompatible from 10 X86 HWIntrinsics
projects (both arm64+osx and arm conditions already covered by
CLRTestTargetUnsupported).
- Remove redundant arm-only GCStressIncompatible from 2 Arm HWIntrinsics
projects (arm condition already covered by CLRTestTargetUnsupported).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add runtime HeapVerify check to ServerModel test using
CoreClrConfigurationDetection.IsHeapVerify (the last project using it).
- Remove HeapVerify skip logic from Batch and Bash execution script targets.
- Remove auto-setting of HeapVerifyIncompatible for disasm-check tests in
CLRTest.Jit.targets.
- Remove all documentation references to HeapVerifyIncompatible.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/gc
See info in area-owners.md if you want to be subscribed.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@MichalStrehovsky

Copy link
Copy Markdown
Member

Before we make more changes to the test tree, it would be nice to make the test tree buildable again. https://github.com/dotnet/runtime/runs/68503855882

I assume this is from #125460, I've seen similar failures when I worked on the Loader tree. It would be nice to re-validate we're still running the same number of tests after #125460, the validation at #125460 (comment) must have missed this.

@jkoritzinsky

Copy link
Copy Markdown
Member

I must have fat fingered the build command and missed the pri1 tests somehow. I'll fix that up before coming back to this.

@jkoritzinsky

Copy link
Copy Markdown
Member

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkoritzinsky

Copy link
Copy Markdown
Member

@copilot some of the projects you've edited still mention that they have RequiresProcessIsolation due to GCStressIncompatible. Please audit the projects you've edited to make sure that the reasons for a project being marked RPI are accurate.

… comments
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/c882c5b1-c293-4d09-8e31-17947a0bdd1e
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>

CopilotAI commented Apr 2, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot some of the projects you've edited still mention that they have RequiresProcessIsolation due to GCStressIncompatible. Please audit the projects you've edited to make sure that the reasons for...

Done in 48bc184. Audited all 78 project files where GCStressIncompatible was removed but the <!-- Needed for GCStressIncompatible, ... --> comment on RequiresProcessIsolation still referenced it. Updated each comment to reflect only the remaining reasons (e.g. UnloadabilityIncompatible, GC.WaitForPendingFinalizers, CMakeProjectReference, etc.). When GCStressIncompatible was the sole reason, the entire comment line was removed.

Comment threadsrc/tests/GC/API/GC/GetAllocatedBytesForCurrentThread.cs Outdated
Comment threadsrc/tests/GC/API/GC/GetGenerationWR2.csproj Outdated
Comment threadsrc/tests/GC/API/WeakReference/IsAlive.csproj Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/hugeexpr1.cs Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/HugeField2.cs Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/HugeField2.csproj Outdated
Comment threadsrc/tests/JIT/opt/Regressions/Regression2_Regressions.cs Outdated
Comment threadsrc/tests/JIT/Regression/JitBlue/DevDiv_255294/DevDiv_255294.csproj Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: dfcc4829-304a-4277-ac35-91ba6510eb70
CopilotAI review requested due to automatic review settings July 23, 2026 19:39

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@jkoritzinsky

Copy link
Copy Markdown
Member

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@jkoritzinsky

Copy link
Copy Markdown
Member

/ba-g no unknown failures but BA still red

@jkoritzinsky
jkoritzinsky enabled auto-merge (squash) July 27, 2026 17:12
@jkoritzinsky
jkoritzinsky merged commit c35b7ab into mainJul 27, 2026
144 of 150 checks passed
@jkoritzinsky
jkoritzinsky deleted the copilot/update-requirements-for-requiresprocessisolation branch July 27, 2026 17:12
@dotnet-milestone-botdotnet-milestone-botBot added this to the 11.0-rc1 milestone Jul 28, 2026
MichalStrehovsky added a commit that referenced this pull request Jul 30, 2026
MichalStrehovsky added a commit that referenced this pull request Jul 30, 2026
@EgorBo

Copy link
Copy Markdown
Member

@jkoritzinsky this seems like badly impacted outerloop CI

PR #126108 (c35b7ab, 2026-07-27 — matches the exact failure onset) migrated <JitOptimizationSensitive>/<GCStressIncompatible> MSBuild properties to [SkipOnCoreClr(...)] attributes. But
for tests with <RequiresProcessIsolation>true</RequiresProcessIsolation>, the generator emits an OutOfProcessTest that just runs the generated .cmd/.sh — xunit attributes on the entry
point are never inspected. So those tests lost their guard entirely

Example: #131447

@EgorBo

Copy link
Copy Markdown
Member

Ah, or was it fixed by #131670?

@jkoritzinsky

Copy link
Copy Markdown
Member

I fixed a particular test there where the rules for RPI were insufficient.

The case you linked that's still open may be due to the test being in il and the Main not being updated.

For IL tests, either reverting to the MSBuild properties or updating the Main method to call the methods on CoreClrConfigurationDetection would fix the issue.

EgorBo added a commit that referenced this pull request Aug 4, 2026
Fixes#131447.
## Root cause
Not a JIT bug. #126108 replaced the `<JitOptimizationSensitive>` and
`<GCStressIncompatible>` MSBuild properties with `[SkipOnCoreClr(...)]`
attributes on test entry points. That works for C# tests and for
in-process IL tests, but silently drops the guard for **IL tests that
also set `<RequiresProcessIsolation>`**:
| Test kind | What evaluates the skip | Result |
| --- | --- | --- |
| C#, any isolation | `GenerateStandaloneSimpleTestRunner` compiles the
check into `__GeneratedMainWrapper.Main` | ✅ honored |
| IL, in-process | merged runner reads the attribute from metadata via
`ExternallyReferencedTestMethodsVisitor` | ✅ honored |
| **IL + process isolation** | merged runner emits an `OutOfProcessTest`
that only calls `RunOutOfProcessTest(...)` on the generated run script,
and `ReferenceXUnitWrapperGenerator` is gated on `'$(Language)' == 'C#'`
so the IL assembly's hand-written `.entrypoint` never gets a wrapper
either | ❌ **nothing reads the attribute** |
In that last case only the MSBuild property puts the guard into the
generated `.cmd`/`.sh`.
`arrres_il_r` keeps its whole body in a single `Main`, so unoptimized
codegen (tier-0, minopts, JIT stress) keeps the `Test` objects alive in
untracked stack slots for the duration of `Main`. They are then never
finalized and never resurrected, and the test throws. It fails on every
default (tiered) run, which is why it lit up across outerloop, jitstress
and pgo on all platforms at once.
## Fix
Restore the MSBuild property on the two affected tests (option 1 from
#126108 (comment)):
- `arrres_il_r.ilproj` → `<JitOptimizationSensitive>`
- `b143840.ilproj` → `<GCStressIncompatible>` (same bug, unguarded on
gcstress legs; it kept `<RequiresProcessIsolation>` for
`<UnloadabilityIncompatible>`)
The `[SkipOnCoreClr]` attributes are intentionally left in place, so the
guard keeps working if either test ever stops requiring process
isolation. Each project gets a comment explaining why the property
cannot be dropped in favour of the attribute.
## Fallout audit
I enumerated all 16 IL tests carrying `[SkipOnCoreClr]` and evaluated
each owning project's *effective* `RequiresProcessIsolation` with
`msbuild -getProperty` (so inherited `Directory.Build.props`/`.targets`
values are accounted for). These two are the only process-isolated ones
— the other 14 are in-process and unaffected.
I also confirmed empirically, rather than by inspection alone, that both
of the "honored" rows above really do emit the guard, by disassembling
the built assemblies:
- `Directed_3.dll` (merged runner, in-process IL) contains `IsJitStress`
/ `IsJitStressRegs` / `IsJitMinOpts` / `IsTailCallStress` /
`IsTieredCompilation` checks guarding the call to
`[AttributeConflict]P::Main()`.
- `ObjectStackAllocationTests.dll` (process-isolated C#) contains the
same checks inside `__GeneratedMainWrapper`.
No C# test is affected by this class of bug.
## Validation
Built and ran the generated run scripts on windows-x64 checked:
```
arrres_il_r default (tiered) SKIP
TieredCompilation=0 PASS (Test passed., 100)
TC=0 + JITMinOpts=1 SKIP
TC=0 + JitStress=2 SKIP
b143840 default PASS
GCStress=0xC SKIP
```
Before the change, `arrres_il_r` reproduced the exact CI signature under
the default environment: unhandled `System.Exception` in
`GCTest_arrres_il.Test.Main`, exit `-532462766`.
cc @jkoritzinsky@jakobbotsch@JulieLeeMSFT
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a984328a-8b6c-4221-b2c9-d668eae5b505
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants

@MichalStrehovsky@jkoritzinsky@EgorBo
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Migrate JitOptimizationSensitive and GCStressIncompatible to SkipOnCoreClr attributes - #126108

Merged
jkoritzinsky merged 30 commits into
mainfrom
copilot/update-requirements-for-requiresprocessisolation
Jul 27, 2026
Merged

Migrate JitOptimizationSensitive and GCStressIncompatible to SkipOnCoreClr attributes#126108
jkoritzinsky merged 30 commits into
mainfrom
copilot/update-requirements-for-requiresprocessisolation

Conversation

CopilotAI commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Replaces eligible MSBuild <JitOptimizationSensitive> and <GCStressIncompatible> properties with [SkipOnCoreClr(...)] applied directly to test entry points, moving skip logic from build-time property injection into the XUnit test runner where the test can safely run without process isolation.

Description

Why

MSBuild properties like <GCStressIncompatible> and <JitOptimizationSensitive> require <RequiresProcessIsolation>true</RequiresProcessIsolation> to take effect — process isolation is expensive. Moving eligible skips to XUnit attributes allows tests to be skipped in-process without spawning a new process per test. Tests that still require process isolation for other reasons retain <RequiresProcessIsolation>true</RequiresProcessIsolation>.

Changes

JitOptimizationSensitive — ilproj tests (4 .il files, 4 .ilproj files)

  • Added SkipOnCoreClrAttribute with AnyJitOptimizationStress (0x11E) to each IL entry point
  • Added .assembly extern Microsoft.DotNet.XUnitExtensions where missing
  • Removed <JitOptimizationSensitive> and sole-cause <RequiresProcessIsolation> from project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to project files that were missing it

GCStressIncompatible — all project types (~310 files total)

C# (150 .cs + 150 .csproj):

  • Added [SkipOnCoreClr("This test is not compatible with GC stress.", RuntimeTestModes.AnyGCStress)] before each [Fact]/[Theory]/[ConditionalFact]/[ConditionalTheory]
  • Removed <GCStressIncompatible> and sole-cause <RequiresProcessIsolation> from project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to 65 csproj files that were missing it
  • Removed dangling <GCStressIncompatible> from project files where the compiled source already had a corresponding [SkipOnCoreClr(..., RuntimeTestModes.AnyGCStress)] attribute

IL (6 .ilproj, 3 .il):

  • 3 GenericContext tests: IL was pre-migrated; removed MSBuild properties from project files
  • 3 JIT regression tests: Added SkipOnCoreClrAttribute (0xC0 = AnyGCStress) to IL entry points; updated project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to 6 ilproj files that were missing it

F#:

  • Runtime_72845 was left on the standalone [<EntryPoint>]/exit-code pattern with <GCStressIncompatible>true</GCStressIncompatible> and <RequiresProcessIsolation>true</RequiresProcessIsolation> retained, because the attempted XUnit conversion did not compile in targeted test builds

HeapVerifyIncompatible — migrated tests

  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to project files that were missing it
  • For tests where <HeapVerifyIncompatible> was conditional on architecture, replaced the unconditional [SkipOnCoreClr(..., RuntimeTestModes.HeapVerify)] with [ConditionalFact] backed by a static bool property that combines the architecture check with TestLibrary.CoreClrConfigurationDetection.IsHeapVerify, preserving the original per-architecture skip semantics

Comment cleanup

  • Audited edited project files where <GCStressIncompatible> was removed and updated or removed stale RequiresProcessIsolation comments
  • Audited orphaned project comments that provided GC stress skip context, removed the orphaned comments, and moved important issue/context details into the corresponding [SkipOnCoreClr(...)] attribute messages
  • Kept remaining RequiresProcessIsolation rationale comments positioned above the <RequiresProcessIsolation> property they describe

Infrastructure and documentation

  • Doubled the browser-wasm (CoreCLR) runtime test work item timeout in helixpublishwitharcade.proj (123 → 246 minutes) to accommodate the larger merged test collections
  • Updated requiresprocessisolation.md to document two additional triggers for <RequiresProcessIsolation>: <IsLongRunningGCTest> and <CLRTestExecutionArguments>

CI failure fixes and process-isolation audit

  • Restored <RequiresProcessIsolation>true</RequiresProcessIsolation> to tests that still require isolation for GC measurement accuracy, long-running GC pre-commands, custom CLR test execution arguments, GC.WaitForPendingFinalizers, unsupported target handling, unloadability, NativeAOT incompatibility, output-copying project references, or Process.Start
  • Added targeted [ActiveIssue] suppressions for CI failures on browser-wasm CoreCLR and Mono interpreter browser-wasm where appropriate
  • Resolved merge conflict in GetTotalAllocatedBytes.cs while preserving GC stress and HeapVerify skip behavior

Not migrated (MSBuild property retained)

  • Tests with ReferenceXUnitWrapperGenerator=false — no XUnit runner
  • Profiler tests — custom host runner with no XUnit
  • HW intrinsics wrapper projects — architecture-conditional property, no owned source
  • OutputType=Library projects — no entry point
  • Tests using top-level statements with no [Fact] method
  • Runtime_72845.fsproj — F# XUnit conversion did not compile in targeted test builds, so this test retains <GCStressIncompatible>true</GCStressIncompatible> and standalone process isolation
  • ReadyToRun tests with crossgen2 shell pre-commands (multifolder, determinism/crossgen2determinism) — [SkipOnCoreClr] only skips the XUnit test body, not pre-commands that run before the test executable
  • Tests that still match requiresprocessisolation.md rules retain <RequiresProcessIsolation>, including projects with CLRTestExecutionArguments, IsLongRunningGCTest, GC.WaitForPendingFinalizers, CLRTestTargetUnsupported, UnloadabilityIncompatible, NativeAotIncompatible, ProjectReference/content copying requirements, or Process.Start

CopilotAIand others added 7 commits March 24, 2026 21:57
…odes.HeapVerify)
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/b9ff7f11-db85-474b-bed1-1e4bd364f234
…ource files
Replace MSBuild property JitOptimizationSensitive with
[SkipOnCoreClr("This test is sensitive to JIT optimizations.", RuntimeTestModes.AnyJitOptimizationStress)]
attribute directly on [Fact]/[Theory] methods across 48 test source files.
Corresponding .csproj files have the <JitOptimizationSensitive> property removed.
RequiresProcessIsolation is also removed from project files where
JitOptimizationSensitive was the sole reason for it.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e migration
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/291e5882-a072-4964-8394-d20db497e472
…IL source files
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/e0266c53-b95c-4538-80c9-b7d881f45840
… ilproj, fsproj
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/66a86949-b520-4439-8d71-659f2b4391fc
…projects
- Remove GCStressIncompatible from 7 OutputType=Library projects where the
property is a no-op.
- Remove redundant conditional GCStressIncompatible from 10 X86 HWIntrinsics
projects (both arm64+osx and arm conditions already covered by
CLRTestTargetUnsupported).
- Remove redundant arm-only GCStressIncompatible from 2 Arm HWIntrinsics
projects (arm condition already covered by CLRTestTargetUnsupported).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add runtime HeapVerify check to ServerModel test using
CoreClrConfigurationDetection.IsHeapVerify (the last project using it).
- Remove HeapVerify skip logic from Batch and Bash execution script targets.
- Remove auto-setting of HeapVerifyIncompatible for disasm-check tests in
CLRTest.Jit.targets.
- Remove all documentation references to HeapVerifyIncompatible.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/gc
See info in area-owners.md if you want to be subscribed.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@MichalStrehovsky

Copy link
Copy Markdown
Member

Before we make more changes to the test tree, it would be nice to make the test tree buildable again. https://github.com/dotnet/runtime/runs/68503855882

I assume this is from #125460, I've seen similar failures when I worked on the Loader tree. It would be nice to re-validate we're still running the same number of tests after #125460, the validation at #125460 (comment) must have missed this.

@jkoritzinsky

Copy link
Copy Markdown
Member

I must have fat fingered the build command and missed the pri1 tests somehow. I'll fix that up before coming back to this.

@jkoritzinsky

Copy link
Copy Markdown
Member

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkoritzinsky

Copy link
Copy Markdown
Member

@copilot some of the projects you've edited still mention that they have RequiresProcessIsolation due to GCStressIncompatible. Please audit the projects you've edited to make sure that the reasons for a project being marked RPI are accurate.

… comments
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/c882c5b1-c293-4d09-8e31-17947a0bdd1e
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>

CopilotAI commented Apr 2, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot some of the projects you've edited still mention that they have RequiresProcessIsolation due to GCStressIncompatible. Please audit the projects you've edited to make sure that the reasons for...

Done in 48bc184. Audited all 78 project files where GCStressIncompatible was removed but the <!-- Needed for GCStressIncompatible, ... --> comment on RequiresProcessIsolation still referenced it. Updated each comment to reflect only the remaining reasons (e.g. UnloadabilityIncompatible, GC.WaitForPendingFinalizers, CMakeProjectReference, etc.). When GCStressIncompatible was the sole reason, the entire comment line was removed.

Comment threadsrc/tests/GC/API/GC/GetAllocatedBytesForCurrentThread.cs Outdated
Comment threadsrc/tests/GC/API/GC/GetGenerationWR2.csproj Outdated
Comment threadsrc/tests/GC/API/WeakReference/IsAlive.csproj Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/hugeexpr1.cs Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/HugeField2.cs Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/HugeField2.csproj Outdated
Comment threadsrc/tests/JIT/opt/Regressions/Regression2_Regressions.cs Outdated
Comment threadsrc/tests/JIT/Regression/JitBlue/DevDiv_255294/DevDiv_255294.csproj Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: dfcc4829-304a-4277-ac35-91ba6510eb70
CopilotAI review requested due to automatic review settings July 23, 2026 19:39

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@jkoritzinsky

Copy link
Copy Markdown
Member

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@jkoritzinsky

Copy link
Copy Markdown
Member

/ba-g no unknown failures but BA still red

@jkoritzinsky
jkoritzinsky enabled auto-merge (squash) July 27, 2026 17:12
@jkoritzinsky
jkoritzinsky merged commit c35b7ab into mainJul 27, 2026
144 of 150 checks passed
@jkoritzinsky
jkoritzinsky deleted the copilot/update-requirements-for-requiresprocessisolation branch July 27, 2026 17:12
@dotnet-milestone-botdotnet-milestone-botBot added this to the 11.0-rc1 milestone Jul 28, 2026
MichalStrehovsky added a commit that referenced this pull request Jul 30, 2026
MichalStrehovsky added a commit that referenced this pull request Jul 30, 2026
@EgorBo

Copy link
Copy Markdown
Member

@jkoritzinsky this seems like badly impacted outerloop CI

PR #126108 (c35b7ab, 2026-07-27 — matches the exact failure onset) migrated <JitOptimizationSensitive>/<GCStressIncompatible> MSBuild properties to [SkipOnCoreClr(...)] attributes. But
for tests with <RequiresProcessIsolation>true</RequiresProcessIsolation>, the generator emits an OutOfProcessTest that just runs the generated .cmd/.sh — xunit attributes on the entry
point are never inspected. So those tests lost their guard entirely

Example: #131447

@EgorBo

Copy link
Copy Markdown
Member

Ah, or was it fixed by #131670?

@jkoritzinsky

Copy link
Copy Markdown
Member

I fixed a particular test there where the rules for RPI were insufficient.

The case you linked that's still open may be due to the test being in il and the Main not being updated.

For IL tests, either reverting to the MSBuild properties or updating the Main method to call the methods on CoreClrConfigurationDetection would fix the issue.

EgorBo added a commit that referenced this pull request Aug 4, 2026
Fixes#131447.
## Root cause
Not a JIT bug. #126108 replaced the `<JitOptimizationSensitive>` and
`<GCStressIncompatible>` MSBuild properties with `[SkipOnCoreClr(...)]`
attributes on test entry points. That works for C# tests and for
in-process IL tests, but silently drops the guard for **IL tests that
also set `<RequiresProcessIsolation>`**:
| Test kind | What evaluates the skip | Result |
| --- | --- | --- |
| C#, any isolation | `GenerateStandaloneSimpleTestRunner` compiles the
check into `__GeneratedMainWrapper.Main` | ✅ honored |
| IL, in-process | merged runner reads the attribute from metadata via
`ExternallyReferencedTestMethodsVisitor` | ✅ honored |
| **IL + process isolation** | merged runner emits an `OutOfProcessTest`
that only calls `RunOutOfProcessTest(...)` on the generated run script,
and `ReferenceXUnitWrapperGenerator` is gated on `'$(Language)' == 'C#'`
so the IL assembly's hand-written `.entrypoint` never gets a wrapper
either | ❌ **nothing reads the attribute** |
In that last case only the MSBuild property puts the guard into the
generated `.cmd`/`.sh`.
`arrres_il_r` keeps its whole body in a single `Main`, so unoptimized
codegen (tier-0, minopts, JIT stress) keeps the `Test` objects alive in
untracked stack slots for the duration of `Main`. They are then never
finalized and never resurrected, and the test throws. It fails on every
default (tiered) run, which is why it lit up across outerloop, jitstress
and pgo on all platforms at once.
## Fix
Restore the MSBuild property on the two affected tests (option 1 from
#126108 (comment)):
- `arrres_il_r.ilproj` → `<JitOptimizationSensitive>`
- `b143840.ilproj` → `<GCStressIncompatible>` (same bug, unguarded on
gcstress legs; it kept `<RequiresProcessIsolation>` for
`<UnloadabilityIncompatible>`)
The `[SkipOnCoreClr]` attributes are intentionally left in place, so the
guard keeps working if either test ever stops requiring process
isolation. Each project gets a comment explaining why the property
cannot be dropped in favour of the attribute.
## Fallout audit
I enumerated all 16 IL tests carrying `[SkipOnCoreClr]` and evaluated
each owning project's *effective* `RequiresProcessIsolation` with
`msbuild -getProperty` (so inherited `Directory.Build.props`/`.targets`
values are accounted for). These two are the only process-isolated ones
— the other 14 are in-process and unaffected.
I also confirmed empirically, rather than by inspection alone, that both
of the "honored" rows above really do emit the guard, by disassembling
the built assemblies:
- `Directed_3.dll` (merged runner, in-process IL) contains `IsJitStress`
/ `IsJitStressRegs` / `IsJitMinOpts` / `IsTailCallStress` /
`IsTieredCompilation` checks guarding the call to
`[AttributeConflict]P::Main()`.
- `ObjectStackAllocationTests.dll` (process-isolated C#) contains the
same checks inside `__GeneratedMainWrapper`.
No C# test is affected by this class of bug.
## Validation
Built and ran the generated run scripts on windows-x64 checked:
```
arrres_il_r default (tiered) SKIP
TieredCompilation=0 PASS (Test passed., 100)
TC=0 + JITMinOpts=1 SKIP
TC=0 + JitStress=2 SKIP
b143840 default PASS
GCStress=0xC SKIP
```
Before the change, `arrres_il_r` reproduced the exact CI signature under
the default environment: unhandled `System.Exception` in
`GCTest_arrres_il.Test.Main`, exit `-532462766`.
cc @jkoritzinsky@jakobbotsch@JulieLeeMSFT
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a984328a-8b6c-4221-b2c9-d668eae5b505
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants

@MichalStrehovsky@jkoritzinsky@EgorBo
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Migrate JitOptimizationSensitive and GCStressIncompatible to SkipOnCoreClr attributes - #126108

Merged
jkoritzinsky merged 30 commits into
mainfrom
copilot/update-requirements-for-requiresprocessisolation
Jul 27, 2026
Merged

Migrate JitOptimizationSensitive and GCStressIncompatible to SkipOnCoreClr attributes#126108
jkoritzinsky merged 30 commits into
mainfrom
copilot/update-requirements-for-requiresprocessisolation

Conversation

CopilotAI commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Replaces eligible MSBuild <JitOptimizationSensitive> and <GCStressIncompatible> properties with [SkipOnCoreClr(...)] applied directly to test entry points, moving skip logic from build-time property injection into the XUnit test runner where the test can safely run without process isolation.

Description

Why

MSBuild properties like <GCStressIncompatible> and <JitOptimizationSensitive> require <RequiresProcessIsolation>true</RequiresProcessIsolation> to take effect — process isolation is expensive. Moving eligible skips to XUnit attributes allows tests to be skipped in-process without spawning a new process per test. Tests that still require process isolation for other reasons retain <RequiresProcessIsolation>true</RequiresProcessIsolation>.

Changes

JitOptimizationSensitive — ilproj tests (4 .il files, 4 .ilproj files)

  • Added SkipOnCoreClrAttribute with AnyJitOptimizationStress (0x11E) to each IL entry point
  • Added .assembly extern Microsoft.DotNet.XUnitExtensions where missing
  • Removed <JitOptimizationSensitive> and sole-cause <RequiresProcessIsolation> from project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to project files that were missing it

GCStressIncompatible — all project types (~310 files total)

C# (150 .cs + 150 .csproj):

  • Added [SkipOnCoreClr("This test is not compatible with GC stress.", RuntimeTestModes.AnyGCStress)] before each [Fact]/[Theory]/[ConditionalFact]/[ConditionalTheory]
  • Removed <GCStressIncompatible> and sole-cause <RequiresProcessIsolation> from project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to 65 csproj files that were missing it
  • Removed dangling <GCStressIncompatible> from project files where the compiled source already had a corresponding [SkipOnCoreClr(..., RuntimeTestModes.AnyGCStress)] attribute

IL (6 .ilproj, 3 .il):

  • 3 GenericContext tests: IL was pre-migrated; removed MSBuild properties from project files
  • 3 JIT regression tests: Added SkipOnCoreClrAttribute (0xC0 = AnyGCStress) to IL entry points; updated project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to 6 ilproj files that were missing it

F#:

  • Runtime_72845 was left on the standalone [<EntryPoint>]/exit-code pattern with <GCStressIncompatible>true</GCStressIncompatible> and <RequiresProcessIsolation>true</RequiresProcessIsolation> retained, because the attempted XUnit conversion did not compile in targeted test builds

HeapVerifyIncompatible — migrated tests

  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to project files that were missing it
  • For tests where <HeapVerifyIncompatible> was conditional on architecture, replaced the unconditional [SkipOnCoreClr(..., RuntimeTestModes.HeapVerify)] with [ConditionalFact] backed by a static bool property that combines the architecture check with TestLibrary.CoreClrConfigurationDetection.IsHeapVerify, preserving the original per-architecture skip semantics

Comment cleanup

  • Audited edited project files where <GCStressIncompatible> was removed and updated or removed stale RequiresProcessIsolation comments
  • Audited orphaned project comments that provided GC stress skip context, removed the orphaned comments, and moved important issue/context details into the corresponding [SkipOnCoreClr(...)] attribute messages
  • Kept remaining RequiresProcessIsolation rationale comments positioned above the <RequiresProcessIsolation> property they describe

Infrastructure and documentation

  • Doubled the browser-wasm (CoreCLR) runtime test work item timeout in helixpublishwitharcade.proj (123 → 246 minutes) to accommodate the larger merged test collections
  • Updated requiresprocessisolation.md to document two additional triggers for <RequiresProcessIsolation>: <IsLongRunningGCTest> and <CLRTestExecutionArguments>

CI failure fixes and process-isolation audit

  • Restored <RequiresProcessIsolation>true</RequiresProcessIsolation> to tests that still require isolation for GC measurement accuracy, long-running GC pre-commands, custom CLR test execution arguments, GC.WaitForPendingFinalizers, unsupported target handling, unloadability, NativeAOT incompatibility, output-copying project references, or Process.Start
  • Added targeted [ActiveIssue] suppressions for CI failures on browser-wasm CoreCLR and Mono interpreter browser-wasm where appropriate
  • Resolved merge conflict in GetTotalAllocatedBytes.cs while preserving GC stress and HeapVerify skip behavior

Not migrated (MSBuild property retained)

  • Tests with ReferenceXUnitWrapperGenerator=false — no XUnit runner
  • Profiler tests — custom host runner with no XUnit
  • HW intrinsics wrapper projects — architecture-conditional property, no owned source
  • OutputType=Library projects — no entry point
  • Tests using top-level statements with no [Fact] method
  • Runtime_72845.fsproj — F# XUnit conversion did not compile in targeted test builds, so this test retains <GCStressIncompatible>true</GCStressIncompatible> and standalone process isolation
  • ReadyToRun tests with crossgen2 shell pre-commands (multifolder, determinism/crossgen2determinism) — [SkipOnCoreClr] only skips the XUnit test body, not pre-commands that run before the test executable
  • Tests that still match requiresprocessisolation.md rules retain <RequiresProcessIsolation>, including projects with CLRTestExecutionArguments, IsLongRunningGCTest, GC.WaitForPendingFinalizers, CLRTestTargetUnsupported, UnloadabilityIncompatible, NativeAotIncompatible, ProjectReference/content copying requirements, or Process.Start

CopilotAIand others added 7 commits March 24, 2026 21:57
…odes.HeapVerify)
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/b9ff7f11-db85-474b-bed1-1e4bd364f234
…ource files
Replace MSBuild property JitOptimizationSensitive with
[SkipOnCoreClr("This test is sensitive to JIT optimizations.", RuntimeTestModes.AnyJitOptimizationStress)]
attribute directly on [Fact]/[Theory] methods across 48 test source files.
Corresponding .csproj files have the <JitOptimizationSensitive> property removed.
RequiresProcessIsolation is also removed from project files where
JitOptimizationSensitive was the sole reason for it.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e migration
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/291e5882-a072-4964-8394-d20db497e472
…IL source files
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/e0266c53-b95c-4538-80c9-b7d881f45840
… ilproj, fsproj
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/66a86949-b520-4439-8d71-659f2b4391fc
…projects
- Remove GCStressIncompatible from 7 OutputType=Library projects where the
property is a no-op.
- Remove redundant conditional GCStressIncompatible from 10 X86 HWIntrinsics
projects (both arm64+osx and arm conditions already covered by
CLRTestTargetUnsupported).
- Remove redundant arm-only GCStressIncompatible from 2 Arm HWIntrinsics
projects (arm condition already covered by CLRTestTargetUnsupported).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add runtime HeapVerify check to ServerModel test using
CoreClrConfigurationDetection.IsHeapVerify (the last project using it).
- Remove HeapVerify skip logic from Batch and Bash execution script targets.
- Remove auto-setting of HeapVerifyIncompatible for disasm-check tests in
CLRTest.Jit.targets.
- Remove all documentation references to HeapVerifyIncompatible.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/gc
See info in area-owners.md if you want to be subscribed.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@MichalStrehovsky

Copy link
Copy Markdown
Member

Before we make more changes to the test tree, it would be nice to make the test tree buildable again. https://github.com/dotnet/runtime/runs/68503855882

I assume this is from #125460, I've seen similar failures when I worked on the Loader tree. It would be nice to re-validate we're still running the same number of tests after #125460, the validation at #125460 (comment) must have missed this.

@jkoritzinsky

Copy link
Copy Markdown
Member

I must have fat fingered the build command and missed the pri1 tests somehow. I'll fix that up before coming back to this.

@jkoritzinsky

Copy link
Copy Markdown
Member

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkoritzinsky

Copy link
Copy Markdown
Member

@copilot some of the projects you've edited still mention that they have RequiresProcessIsolation due to GCStressIncompatible. Please audit the projects you've edited to make sure that the reasons for a project being marked RPI are accurate.

… comments
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/c882c5b1-c293-4d09-8e31-17947a0bdd1e
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>

CopilotAI commented Apr 2, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot some of the projects you've edited still mention that they have RequiresProcessIsolation due to GCStressIncompatible. Please audit the projects you've edited to make sure that the reasons for...

Done in 48bc184. Audited all 78 project files where GCStressIncompatible was removed but the <!-- Needed for GCStressIncompatible, ... --> comment on RequiresProcessIsolation still referenced it. Updated each comment to reflect only the remaining reasons (e.g. UnloadabilityIncompatible, GC.WaitForPendingFinalizers, CMakeProjectReference, etc.). When GCStressIncompatible was the sole reason, the entire comment line was removed.

Comment threadsrc/tests/GC/API/GC/GetAllocatedBytesForCurrentThread.cs Outdated
Comment threadsrc/tests/GC/API/GC/GetGenerationWR2.csproj Outdated
Comment threadsrc/tests/GC/API/WeakReference/IsAlive.csproj Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/hugeexpr1.cs Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/HugeField2.cs Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/HugeField2.csproj Outdated
Comment threadsrc/tests/JIT/opt/Regressions/Regression2_Regressions.cs Outdated
Comment threadsrc/tests/JIT/Regression/JitBlue/DevDiv_255294/DevDiv_255294.csproj Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: dfcc4829-304a-4277-ac35-91ba6510eb70
CopilotAI review requested due to automatic review settings July 23, 2026 19:39

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@jkoritzinsky

Copy link
Copy Markdown
Member

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@jkoritzinsky

Copy link
Copy Markdown
Member

/ba-g no unknown failures but BA still red

@jkoritzinsky
jkoritzinsky enabled auto-merge (squash) July 27, 2026 17:12
@jkoritzinsky
jkoritzinsky merged commit c35b7ab into mainJul 27, 2026
144 of 150 checks passed
@jkoritzinsky
jkoritzinsky deleted the copilot/update-requirements-for-requiresprocessisolation branch July 27, 2026 17:12
@dotnet-milestone-botdotnet-milestone-botBot added this to the 11.0-rc1 milestone Jul 28, 2026
MichalStrehovsky added a commit that referenced this pull request Jul 30, 2026
MichalStrehovsky added a commit that referenced this pull request Jul 30, 2026
@EgorBo

Copy link
Copy Markdown
Member

@jkoritzinsky this seems like badly impacted outerloop CI

PR #126108 (c35b7ab, 2026-07-27 — matches the exact failure onset) migrated <JitOptimizationSensitive>/<GCStressIncompatible> MSBuild properties to [SkipOnCoreClr(...)] attributes. But
for tests with <RequiresProcessIsolation>true</RequiresProcessIsolation>, the generator emits an OutOfProcessTest that just runs the generated .cmd/.sh — xunit attributes on the entry
point are never inspected. So those tests lost their guard entirely

Example: #131447

@EgorBo

Copy link
Copy Markdown
Member

Ah, or was it fixed by #131670?

@jkoritzinsky

Copy link
Copy Markdown
Member

I fixed a particular test there where the rules for RPI were insufficient.

The case you linked that's still open may be due to the test being in il and the Main not being updated.

For IL tests, either reverting to the MSBuild properties or updating the Main method to call the methods on CoreClrConfigurationDetection would fix the issue.

EgorBo added a commit that referenced this pull request Aug 4, 2026
Fixes#131447.
## Root cause
Not a JIT bug. #126108 replaced the `<JitOptimizationSensitive>` and
`<GCStressIncompatible>` MSBuild properties with `[SkipOnCoreClr(...)]`
attributes on test entry points. That works for C# tests and for
in-process IL tests, but silently drops the guard for **IL tests that
also set `<RequiresProcessIsolation>`**:
| Test kind | What evaluates the skip | Result |
| --- | --- | --- |
| C#, any isolation | `GenerateStandaloneSimpleTestRunner` compiles the
check into `__GeneratedMainWrapper.Main` | ✅ honored |
| IL, in-process | merged runner reads the attribute from metadata via
`ExternallyReferencedTestMethodsVisitor` | ✅ honored |
| **IL + process isolation** | merged runner emits an `OutOfProcessTest`
that only calls `RunOutOfProcessTest(...)` on the generated run script,
and `ReferenceXUnitWrapperGenerator` is gated on `'$(Language)' == 'C#'`
so the IL assembly's hand-written `.entrypoint` never gets a wrapper
either | ❌ **nothing reads the attribute** |
In that last case only the MSBuild property puts the guard into the
generated `.cmd`/`.sh`.
`arrres_il_r` keeps its whole body in a single `Main`, so unoptimized
codegen (tier-0, minopts, JIT stress) keeps the `Test` objects alive in
untracked stack slots for the duration of `Main`. They are then never
finalized and never resurrected, and the test throws. It fails on every
default (tiered) run, which is why it lit up across outerloop, jitstress
and pgo on all platforms at once.
## Fix
Restore the MSBuild property on the two affected tests (option 1 from
#126108 (comment)):
- `arrres_il_r.ilproj` → `<JitOptimizationSensitive>`
- `b143840.ilproj` → `<GCStressIncompatible>` (same bug, unguarded on
gcstress legs; it kept `<RequiresProcessIsolation>` for
`<UnloadabilityIncompatible>`)
The `[SkipOnCoreClr]` attributes are intentionally left in place, so the
guard keeps working if either test ever stops requiring process
isolation. Each project gets a comment explaining why the property
cannot be dropped in favour of the attribute.
## Fallout audit
I enumerated all 16 IL tests carrying `[SkipOnCoreClr]` and evaluated
each owning project's *effective* `RequiresProcessIsolation` with
`msbuild -getProperty` (so inherited `Directory.Build.props`/`.targets`
values are accounted for). These two are the only process-isolated ones
— the other 14 are in-process and unaffected.
I also confirmed empirically, rather than by inspection alone, that both
of the "honored" rows above really do emit the guard, by disassembling
the built assemblies:
- `Directed_3.dll` (merged runner, in-process IL) contains `IsJitStress`
/ `IsJitStressRegs` / `IsJitMinOpts` / `IsTailCallStress` /
`IsTieredCompilation` checks guarding the call to
`[AttributeConflict]P::Main()`.
- `ObjectStackAllocationTests.dll` (process-isolated C#) contains the
same checks inside `__GeneratedMainWrapper`.
No C# test is affected by this class of bug.
## Validation
Built and ran the generated run scripts on windows-x64 checked:
```
arrres_il_r default (tiered) SKIP
TieredCompilation=0 PASS (Test passed., 100)
TC=0 + JITMinOpts=1 SKIP
TC=0 + JitStress=2 SKIP
b143840 default PASS
GCStress=0xC SKIP
```
Before the change, `arrres_il_r` reproduced the exact CI signature under
the default environment: unhandled `System.Exception` in
`GCTest_arrres_il.Test.Main`, exit `-532462766`.
cc @jkoritzinsky@jakobbotsch@JulieLeeMSFT
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a984328a-8b6c-4221-b2c9-d668eae5b505
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants

@MichalStrehovsky@jkoritzinsky@EgorBo
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Migrate JitOptimizationSensitive and GCStressIncompatible to SkipOnCoreClr attributes - #126108

Merged
jkoritzinsky merged 30 commits into
mainfrom
copilot/update-requirements-for-requiresprocessisolation
Jul 27, 2026
Merged

Migrate JitOptimizationSensitive and GCStressIncompatible to SkipOnCoreClr attributes#126108
jkoritzinsky merged 30 commits into
mainfrom
copilot/update-requirements-for-requiresprocessisolation

Conversation

CopilotAI commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Replaces eligible MSBuild <JitOptimizationSensitive> and <GCStressIncompatible> properties with [SkipOnCoreClr(...)] applied directly to test entry points, moving skip logic from build-time property injection into the XUnit test runner where the test can safely run without process isolation.

Description

Why

MSBuild properties like <GCStressIncompatible> and <JitOptimizationSensitive> require <RequiresProcessIsolation>true</RequiresProcessIsolation> to take effect — process isolation is expensive. Moving eligible skips to XUnit attributes allows tests to be skipped in-process without spawning a new process per test. Tests that still require process isolation for other reasons retain <RequiresProcessIsolation>true</RequiresProcessIsolation>.

Changes

JitOptimizationSensitive — ilproj tests (4 .il files, 4 .ilproj files)

  • Added SkipOnCoreClrAttribute with AnyJitOptimizationStress (0x11E) to each IL entry point
  • Added .assembly extern Microsoft.DotNet.XUnitExtensions where missing
  • Removed <JitOptimizationSensitive> and sole-cause <RequiresProcessIsolation> from project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to project files that were missing it

GCStressIncompatible — all project types (~310 files total)

C# (150 .cs + 150 .csproj):

  • Added [SkipOnCoreClr("This test is not compatible with GC stress.", RuntimeTestModes.AnyGCStress)] before each [Fact]/[Theory]/[ConditionalFact]/[ConditionalTheory]
  • Removed <GCStressIncompatible> and sole-cause <RequiresProcessIsolation> from project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to 65 csproj files that were missing it
  • Removed dangling <GCStressIncompatible> from project files where the compiled source already had a corresponding [SkipOnCoreClr(..., RuntimeTestModes.AnyGCStress)] attribute

IL (6 .ilproj, 3 .il):

  • 3 GenericContext tests: IL was pre-migrated; removed MSBuild properties from project files
  • 3 JIT regression tests: Added SkipOnCoreClrAttribute (0xC0 = AnyGCStress) to IL entry points; updated project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to 6 ilproj files that were missing it

F#:

  • Runtime_72845 was left on the standalone [<EntryPoint>]/exit-code pattern with <GCStressIncompatible>true</GCStressIncompatible> and <RequiresProcessIsolation>true</RequiresProcessIsolation> retained, because the attempted XUnit conversion did not compile in targeted test builds

HeapVerifyIncompatible — migrated tests

  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to project files that were missing it
  • For tests where <HeapVerifyIncompatible> was conditional on architecture, replaced the unconditional [SkipOnCoreClr(..., RuntimeTestModes.HeapVerify)] with [ConditionalFact] backed by a static bool property that combines the architecture check with TestLibrary.CoreClrConfigurationDetection.IsHeapVerify, preserving the original per-architecture skip semantics

Comment cleanup

  • Audited edited project files where <GCStressIncompatible> was removed and updated or removed stale RequiresProcessIsolation comments
  • Audited orphaned project comments that provided GC stress skip context, removed the orphaned comments, and moved important issue/context details into the corresponding [SkipOnCoreClr(...)] attribute messages
  • Kept remaining RequiresProcessIsolation rationale comments positioned above the <RequiresProcessIsolation> property they describe

Infrastructure and documentation

  • Doubled the browser-wasm (CoreCLR) runtime test work item timeout in helixpublishwitharcade.proj (123 → 246 minutes) to accommodate the larger merged test collections
  • Updated requiresprocessisolation.md to document two additional triggers for <RequiresProcessIsolation>: <IsLongRunningGCTest> and <CLRTestExecutionArguments>

CI failure fixes and process-isolation audit

  • Restored <RequiresProcessIsolation>true</RequiresProcessIsolation> to tests that still require isolation for GC measurement accuracy, long-running GC pre-commands, custom CLR test execution arguments, GC.WaitForPendingFinalizers, unsupported target handling, unloadability, NativeAOT incompatibility, output-copying project references, or Process.Start
  • Added targeted [ActiveIssue] suppressions for CI failures on browser-wasm CoreCLR and Mono interpreter browser-wasm where appropriate
  • Resolved merge conflict in GetTotalAllocatedBytes.cs while preserving GC stress and HeapVerify skip behavior

Not migrated (MSBuild property retained)

  • Tests with ReferenceXUnitWrapperGenerator=false — no XUnit runner
  • Profiler tests — custom host runner with no XUnit
  • HW intrinsics wrapper projects — architecture-conditional property, no owned source
  • OutputType=Library projects — no entry point
  • Tests using top-level statements with no [Fact] method
  • Runtime_72845.fsproj — F# XUnit conversion did not compile in targeted test builds, so this test retains <GCStressIncompatible>true</GCStressIncompatible> and standalone process isolation
  • ReadyToRun tests with crossgen2 shell pre-commands (multifolder, determinism/crossgen2determinism) — [SkipOnCoreClr] only skips the XUnit test body, not pre-commands that run before the test executable
  • Tests that still match requiresprocessisolation.md rules retain <RequiresProcessIsolation>, including projects with CLRTestExecutionArguments, IsLongRunningGCTest, GC.WaitForPendingFinalizers, CLRTestTargetUnsupported, UnloadabilityIncompatible, NativeAotIncompatible, ProjectReference/content copying requirements, or Process.Start

CopilotAIand others added 7 commits March 24, 2026 21:57
…odes.HeapVerify)
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/b9ff7f11-db85-474b-bed1-1e4bd364f234
…ource files
Replace MSBuild property JitOptimizationSensitive with
[SkipOnCoreClr("This test is sensitive to JIT optimizations.", RuntimeTestModes.AnyJitOptimizationStress)]
attribute directly on [Fact]/[Theory] methods across 48 test source files.
Corresponding .csproj files have the <JitOptimizationSensitive> property removed.
RequiresProcessIsolation is also removed from project files where
JitOptimizationSensitive was the sole reason for it.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e migration
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/291e5882-a072-4964-8394-d20db497e472
…IL source files
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/e0266c53-b95c-4538-80c9-b7d881f45840
… ilproj, fsproj
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/66a86949-b520-4439-8d71-659f2b4391fc
…projects
- Remove GCStressIncompatible from 7 OutputType=Library projects where the
property is a no-op.
- Remove redundant conditional GCStressIncompatible from 10 X86 HWIntrinsics
projects (both arm64+osx and arm conditions already covered by
CLRTestTargetUnsupported).
- Remove redundant arm-only GCStressIncompatible from 2 Arm HWIntrinsics
projects (arm condition already covered by CLRTestTargetUnsupported).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add runtime HeapVerify check to ServerModel test using
CoreClrConfigurationDetection.IsHeapVerify (the last project using it).
- Remove HeapVerify skip logic from Batch and Bash execution script targets.
- Remove auto-setting of HeapVerifyIncompatible for disasm-check tests in
CLRTest.Jit.targets.
- Remove all documentation references to HeapVerifyIncompatible.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/gc
See info in area-owners.md if you want to be subscribed.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@MichalStrehovsky

Copy link
Copy Markdown
Member

Before we make more changes to the test tree, it would be nice to make the test tree buildable again. https://github.com/dotnet/runtime/runs/68503855882

I assume this is from #125460, I've seen similar failures when I worked on the Loader tree. It would be nice to re-validate we're still running the same number of tests after #125460, the validation at #125460 (comment) must have missed this.

@jkoritzinsky

Copy link
Copy Markdown
Member

I must have fat fingered the build command and missed the pri1 tests somehow. I'll fix that up before coming back to this.

@jkoritzinsky

Copy link
Copy Markdown
Member

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkoritzinsky

Copy link
Copy Markdown
Member

@copilot some of the projects you've edited still mention that they have RequiresProcessIsolation due to GCStressIncompatible. Please audit the projects you've edited to make sure that the reasons for a project being marked RPI are accurate.

… comments
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/c882c5b1-c293-4d09-8e31-17947a0bdd1e
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>

CopilotAI commented Apr 2, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot some of the projects you've edited still mention that they have RequiresProcessIsolation due to GCStressIncompatible. Please audit the projects you've edited to make sure that the reasons for...

Done in 48bc184. Audited all 78 project files where GCStressIncompatible was removed but the <!-- Needed for GCStressIncompatible, ... --> comment on RequiresProcessIsolation still referenced it. Updated each comment to reflect only the remaining reasons (e.g. UnloadabilityIncompatible, GC.WaitForPendingFinalizers, CMakeProjectReference, etc.). When GCStressIncompatible was the sole reason, the entire comment line was removed.

Comment threadsrc/tests/GC/API/GC/GetAllocatedBytesForCurrentThread.cs Outdated
Comment threadsrc/tests/GC/API/GC/GetGenerationWR2.csproj Outdated
Comment threadsrc/tests/GC/API/WeakReference/IsAlive.csproj Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/hugeexpr1.cs Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/HugeField2.cs Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/HugeField2.csproj Outdated
Comment threadsrc/tests/JIT/opt/Regressions/Regression2_Regressions.cs Outdated
Comment threadsrc/tests/JIT/Regression/JitBlue/DevDiv_255294/DevDiv_255294.csproj Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: dfcc4829-304a-4277-ac35-91ba6510eb70
CopilotAI review requested due to automatic review settings July 23, 2026 19:39

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@jkoritzinsky

Copy link
Copy Markdown
Member

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@jkoritzinsky

Copy link
Copy Markdown
Member

/ba-g no unknown failures but BA still red

@jkoritzinsky
jkoritzinsky enabled auto-merge (squash) July 27, 2026 17:12
@jkoritzinsky
jkoritzinsky merged commit c35b7ab into mainJul 27, 2026
144 of 150 checks passed
@jkoritzinsky
jkoritzinsky deleted the copilot/update-requirements-for-requiresprocessisolation branch July 27, 2026 17:12
@dotnet-milestone-botdotnet-milestone-botBot added this to the 11.0-rc1 milestone Jul 28, 2026
MichalStrehovsky added a commit that referenced this pull request Jul 30, 2026
MichalStrehovsky added a commit that referenced this pull request Jul 30, 2026
@EgorBo

Copy link
Copy Markdown
Member

@jkoritzinsky this seems like badly impacted outerloop CI

PR #126108 (c35b7ab, 2026-07-27 — matches the exact failure onset) migrated <JitOptimizationSensitive>/<GCStressIncompatible> MSBuild properties to [SkipOnCoreClr(...)] attributes. But
for tests with <RequiresProcessIsolation>true</RequiresProcessIsolation>, the generator emits an OutOfProcessTest that just runs the generated .cmd/.sh — xunit attributes on the entry
point are never inspected. So those tests lost their guard entirely

Example: #131447

@EgorBo

Copy link
Copy Markdown
Member

Ah, or was it fixed by #131670?

@jkoritzinsky

Copy link
Copy Markdown
Member

I fixed a particular test there where the rules for RPI were insufficient.

The case you linked that's still open may be due to the test being in il and the Main not being updated.

For IL tests, either reverting to the MSBuild properties or updating the Main method to call the methods on CoreClrConfigurationDetection would fix the issue.

EgorBo added a commit that referenced this pull request Aug 4, 2026
Fixes#131447.
## Root cause
Not a JIT bug. #126108 replaced the `<JitOptimizationSensitive>` and
`<GCStressIncompatible>` MSBuild properties with `[SkipOnCoreClr(...)]`
attributes on test entry points. That works for C# tests and for
in-process IL tests, but silently drops the guard for **IL tests that
also set `<RequiresProcessIsolation>`**:
| Test kind | What evaluates the skip | Result |
| --- | --- | --- |
| C#, any isolation | `GenerateStandaloneSimpleTestRunner` compiles the
check into `__GeneratedMainWrapper.Main` | ✅ honored |
| IL, in-process | merged runner reads the attribute from metadata via
`ExternallyReferencedTestMethodsVisitor` | ✅ honored |
| **IL + process isolation** | merged runner emits an `OutOfProcessTest`
that only calls `RunOutOfProcessTest(...)` on the generated run script,
and `ReferenceXUnitWrapperGenerator` is gated on `'$(Language)' == 'C#'`
so the IL assembly's hand-written `.entrypoint` never gets a wrapper
either | ❌ **nothing reads the attribute** |
In that last case only the MSBuild property puts the guard into the
generated `.cmd`/`.sh`.
`arrres_il_r` keeps its whole body in a single `Main`, so unoptimized
codegen (tier-0, minopts, JIT stress) keeps the `Test` objects alive in
untracked stack slots for the duration of `Main`. They are then never
finalized and never resurrected, and the test throws. It fails on every
default (tiered) run, which is why it lit up across outerloop, jitstress
and pgo on all platforms at once.
## Fix
Restore the MSBuild property on the two affected tests (option 1 from
#126108 (comment)):
- `arrres_il_r.ilproj` → `<JitOptimizationSensitive>`
- `b143840.ilproj` → `<GCStressIncompatible>` (same bug, unguarded on
gcstress legs; it kept `<RequiresProcessIsolation>` for
`<UnloadabilityIncompatible>`)
The `[SkipOnCoreClr]` attributes are intentionally left in place, so the
guard keeps working if either test ever stops requiring process
isolation. Each project gets a comment explaining why the property
cannot be dropped in favour of the attribute.
## Fallout audit
I enumerated all 16 IL tests carrying `[SkipOnCoreClr]` and evaluated
each owning project's *effective* `RequiresProcessIsolation` with
`msbuild -getProperty` (so inherited `Directory.Build.props`/`.targets`
values are accounted for). These two are the only process-isolated ones
— the other 14 are in-process and unaffected.
I also confirmed empirically, rather than by inspection alone, that both
of the "honored" rows above really do emit the guard, by disassembling
the built assemblies:
- `Directed_3.dll` (merged runner, in-process IL) contains `IsJitStress`
/ `IsJitStressRegs` / `IsJitMinOpts` / `IsTailCallStress` /
`IsTieredCompilation` checks guarding the call to
`[AttributeConflict]P::Main()`.
- `ObjectStackAllocationTests.dll` (process-isolated C#) contains the
same checks inside `__GeneratedMainWrapper`.
No C# test is affected by this class of bug.
## Validation
Built and ran the generated run scripts on windows-x64 checked:
```
arrres_il_r default (tiered) SKIP
TieredCompilation=0 PASS (Test passed., 100)
TC=0 + JITMinOpts=1 SKIP
TC=0 + JitStress=2 SKIP
b143840 default PASS
GCStress=0xC SKIP
```
Before the change, `arrres_il_r` reproduced the exact CI signature under
the default environment: unhandled `System.Exception` in
`GCTest_arrres_il.Test.Main`, exit `-532462766`.
cc @jkoritzinsky@jakobbotsch@JulieLeeMSFT
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a984328a-8b6c-4221-b2c9-d668eae5b505
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants

@MichalStrehovsky@jkoritzinsky@EgorBo
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Migrate JitOptimizationSensitive and GCStressIncompatible to SkipOnCoreClr attributes - #126108

Merged
jkoritzinsky merged 30 commits into
mainfrom
copilot/update-requirements-for-requiresprocessisolation
Jul 27, 2026
Merged

Migrate JitOptimizationSensitive and GCStressIncompatible to SkipOnCoreClr attributes#126108
jkoritzinsky merged 30 commits into
mainfrom
copilot/update-requirements-for-requiresprocessisolation

Conversation

CopilotAI commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Replaces eligible MSBuild <JitOptimizationSensitive> and <GCStressIncompatible> properties with [SkipOnCoreClr(...)] applied directly to test entry points, moving skip logic from build-time property injection into the XUnit test runner where the test can safely run without process isolation.

Description

Why

MSBuild properties like <GCStressIncompatible> and <JitOptimizationSensitive> require <RequiresProcessIsolation>true</RequiresProcessIsolation> to take effect — process isolation is expensive. Moving eligible skips to XUnit attributes allows tests to be skipped in-process without spawning a new process per test. Tests that still require process isolation for other reasons retain <RequiresProcessIsolation>true</RequiresProcessIsolation>.

Changes

JitOptimizationSensitive — ilproj tests (4 .il files, 4 .ilproj files)

  • Added SkipOnCoreClrAttribute with AnyJitOptimizationStress (0x11E) to each IL entry point
  • Added .assembly extern Microsoft.DotNet.XUnitExtensions where missing
  • Removed <JitOptimizationSensitive> and sole-cause <RequiresProcessIsolation> from project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to project files that were missing it

GCStressIncompatible — all project types (~310 files total)

C# (150 .cs + 150 .csproj):

  • Added [SkipOnCoreClr("This test is not compatible with GC stress.", RuntimeTestModes.AnyGCStress)] before each [Fact]/[Theory]/[ConditionalFact]/[ConditionalTheory]
  • Removed <GCStressIncompatible> and sole-cause <RequiresProcessIsolation> from project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to 65 csproj files that were missing it
  • Removed dangling <GCStressIncompatible> from project files where the compiled source already had a corresponding [SkipOnCoreClr(..., RuntimeTestModes.AnyGCStress)] attribute

IL (6 .ilproj, 3 .il):

  • 3 GenericContext tests: IL was pre-migrated; removed MSBuild properties from project files
  • 3 JIT regression tests: Added SkipOnCoreClrAttribute (0xC0 = AnyGCStress) to IL entry points; updated project files
  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to 6 ilproj files that were missing it

F#:

  • Runtime_72845 was left on the standalone [<EntryPoint>]/exit-code pattern with <GCStressIncompatible>true</GCStressIncompatible> and <RequiresProcessIsolation>true</RequiresProcessIsolation> retained, because the attempted XUnit conversion did not compile in targeted test builds

HeapVerifyIncompatible — migrated tests

  • Added <ProjectReference Include="$(TestLibraryProjectPath)" /> to project files that were missing it
  • For tests where <HeapVerifyIncompatible> was conditional on architecture, replaced the unconditional [SkipOnCoreClr(..., RuntimeTestModes.HeapVerify)] with [ConditionalFact] backed by a static bool property that combines the architecture check with TestLibrary.CoreClrConfigurationDetection.IsHeapVerify, preserving the original per-architecture skip semantics

Comment cleanup

  • Audited edited project files where <GCStressIncompatible> was removed and updated or removed stale RequiresProcessIsolation comments
  • Audited orphaned project comments that provided GC stress skip context, removed the orphaned comments, and moved important issue/context details into the corresponding [SkipOnCoreClr(...)] attribute messages
  • Kept remaining RequiresProcessIsolation rationale comments positioned above the <RequiresProcessIsolation> property they describe

Infrastructure and documentation

  • Doubled the browser-wasm (CoreCLR) runtime test work item timeout in helixpublishwitharcade.proj (123 → 246 minutes) to accommodate the larger merged test collections
  • Updated requiresprocessisolation.md to document two additional triggers for <RequiresProcessIsolation>: <IsLongRunningGCTest> and <CLRTestExecutionArguments>

CI failure fixes and process-isolation audit

  • Restored <RequiresProcessIsolation>true</RequiresProcessIsolation> to tests that still require isolation for GC measurement accuracy, long-running GC pre-commands, custom CLR test execution arguments, GC.WaitForPendingFinalizers, unsupported target handling, unloadability, NativeAOT incompatibility, output-copying project references, or Process.Start
  • Added targeted [ActiveIssue] suppressions for CI failures on browser-wasm CoreCLR and Mono interpreter browser-wasm where appropriate
  • Resolved merge conflict in GetTotalAllocatedBytes.cs while preserving GC stress and HeapVerify skip behavior

Not migrated (MSBuild property retained)

  • Tests with ReferenceXUnitWrapperGenerator=false — no XUnit runner
  • Profiler tests — custom host runner with no XUnit
  • HW intrinsics wrapper projects — architecture-conditional property, no owned source
  • OutputType=Library projects — no entry point
  • Tests using top-level statements with no [Fact] method
  • Runtime_72845.fsproj — F# XUnit conversion did not compile in targeted test builds, so this test retains <GCStressIncompatible>true</GCStressIncompatible> and standalone process isolation
  • ReadyToRun tests with crossgen2 shell pre-commands (multifolder, determinism/crossgen2determinism) — [SkipOnCoreClr] only skips the XUnit test body, not pre-commands that run before the test executable
  • Tests that still match requiresprocessisolation.md rules retain <RequiresProcessIsolation>, including projects with CLRTestExecutionArguments, IsLongRunningGCTest, GC.WaitForPendingFinalizers, CLRTestTargetUnsupported, UnloadabilityIncompatible, NativeAotIncompatible, ProjectReference/content copying requirements, or Process.Start

CopilotAIand others added 7 commits March 24, 2026 21:57
…odes.HeapVerify)
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/b9ff7f11-db85-474b-bed1-1e4bd364f234
…ource files
Replace MSBuild property JitOptimizationSensitive with
[SkipOnCoreClr("This test is sensitive to JIT optimizations.", RuntimeTestModes.AnyJitOptimizationStress)]
attribute directly on [Fact]/[Theory] methods across 48 test source files.
Corresponding .csproj files have the <JitOptimizationSensitive> property removed.
RequiresProcessIsolation is also removed from project files where
JitOptimizationSensitive was the sole reason for it.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e migration
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/291e5882-a072-4964-8394-d20db497e472
…IL source files
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/e0266c53-b95c-4538-80c9-b7d881f45840
… ilproj, fsproj
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/66a86949-b520-4439-8d71-659f2b4391fc
…projects
- Remove GCStressIncompatible from 7 OutputType=Library projects where the
property is a no-op.
- Remove redundant conditional GCStressIncompatible from 10 X86 HWIntrinsics
projects (both arm64+osx and arm conditions already covered by
CLRTestTargetUnsupported).
- Remove redundant arm-only GCStressIncompatible from 2 Arm HWIntrinsics
projects (arm condition already covered by CLRTestTargetUnsupported).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add runtime HeapVerify check to ServerModel test using
CoreClrConfigurationDetection.IsHeapVerify (the last project using it).
- Remove HeapVerify skip logic from Batch and Bash execution script targets.
- Remove auto-setting of HeapVerifyIncompatible for disasm-check tests in
CLRTest.Jit.targets.
- Remove all documentation references to HeapVerifyIncompatible.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/gc
See info in area-owners.md if you want to be subscribed.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@MichalStrehovsky

Copy link
Copy Markdown
Member

Before we make more changes to the test tree, it would be nice to make the test tree buildable again. https://github.com/dotnet/runtime/runs/68503855882

I assume this is from #125460, I've seen similar failures when I worked on the Loader tree. It would be nice to re-validate we're still running the same number of tests after #125460, the validation at #125460 (comment) must have missed this.

@jkoritzinsky

Copy link
Copy Markdown
Member

I must have fat fingered the build command and missed the pri1 tests somehow. I'll fix that up before coming back to this.

@jkoritzinsky

Copy link
Copy Markdown
Member

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkoritzinsky

Copy link
Copy Markdown
Member

@copilot some of the projects you've edited still mention that they have RequiresProcessIsolation due to GCStressIncompatible. Please audit the projects you've edited to make sure that the reasons for a project being marked RPI are accurate.

… comments
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/c882c5b1-c293-4d09-8e31-17947a0bdd1e
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>

CopilotAI commented Apr 2, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot some of the projects you've edited still mention that they have RequiresProcessIsolation due to GCStressIncompatible. Please audit the projects you've edited to make sure that the reasons for...

Done in 48bc184. Audited all 78 project files where GCStressIncompatible was removed but the <!-- Needed for GCStressIncompatible, ... --> comment on RequiresProcessIsolation still referenced it. Updated each comment to reflect only the remaining reasons (e.g. UnloadabilityIncompatible, GC.WaitForPendingFinalizers, CMakeProjectReference, etc.). When GCStressIncompatible was the sole reason, the entire comment line was removed.

Comment threadsrc/tests/GC/API/GC/GetAllocatedBytesForCurrentThread.cs Outdated
Comment threadsrc/tests/GC/API/GC/GetGenerationWR2.csproj Outdated
Comment threadsrc/tests/GC/API/WeakReference/IsAlive.csproj Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/hugeexpr1.cs Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/HugeField2.cs Outdated
Comment threadsrc/tests/JIT/jit64/opt/cse/HugeField2.csproj Outdated
Comment threadsrc/tests/JIT/opt/Regressions/Regression2_Regressions.cs Outdated
Comment threadsrc/tests/JIT/Regression/JitBlue/DevDiv_255294/DevDiv_255294.csproj Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: dfcc4829-304a-4277-ac35-91ba6510eb70
CopilotAI review requested due to automatic review settings July 23, 2026 19:39

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@jkoritzinsky

Copy link
Copy Markdown
Member

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@jkoritzinsky

Copy link
Copy Markdown
Member

/ba-g no unknown failures but BA still red

@jkoritzinsky
jkoritzinsky enabled auto-merge (squash) July 27, 2026 17:12
@jkoritzinsky
jkoritzinsky merged commit c35b7ab into mainJul 27, 2026
144 of 150 checks passed
@jkoritzinsky
jkoritzinsky deleted the copilot/update-requirements-for-requiresprocessisolation branch July 27, 2026 17:12
@dotnet-milestone-botdotnet-milestone-botBot added this to the 11.0-rc1 milestone Jul 28, 2026
MichalStrehovsky added a commit that referenced this pull request Jul 30, 2026
MichalStrehovsky added a commit that referenced this pull request Jul 30, 2026
@EgorBo

Copy link
Copy Markdown
Member

@jkoritzinsky this seems like badly impacted outerloop CI

PR #126108 (c35b7ab, 2026-07-27 — matches the exact failure onset) migrated <JitOptimizationSensitive>/<GCStressIncompatible> MSBuild properties to [SkipOnCoreClr(...)] attributes. But
for tests with <RequiresProcessIsolation>true</RequiresProcessIsolation>, the generator emits an OutOfProcessTest that just runs the generated .cmd/.sh — xunit attributes on the entry
point are never inspected. So those tests lost their guard entirely

Example: #131447

@EgorBo

Copy link
Copy Markdown
Member

Ah, or was it fixed by #131670?

@jkoritzinsky

Copy link
Copy Markdown
Member

I fixed a particular test there where the rules for RPI were insufficient.

The case you linked that's still open may be due to the test being in il and the Main not being updated.

For IL tests, either reverting to the MSBuild properties or updating the Main method to call the methods on CoreClrConfigurationDetection would fix the issue.

EgorBo added a commit that referenced this pull request Aug 4, 2026
Fixes#131447.
## Root cause
Not a JIT bug. #126108 replaced the `<JitOptimizationSensitive>` and
`<GCStressIncompatible>` MSBuild properties with `[SkipOnCoreClr(...)]`
attributes on test entry points. That works for C# tests and for
in-process IL tests, but silently drops the guard for **IL tests that
also set `<RequiresProcessIsolation>`**:
| Test kind | What evaluates the skip | Result |
| --- | --- | --- |
| C#, any isolation | `GenerateStandaloneSimpleTestRunner` compiles the
check into `__GeneratedMainWrapper.Main` | ✅ honored |
| IL, in-process | merged runner reads the attribute from metadata via
`ExternallyReferencedTestMethodsVisitor` | ✅ honored |
| **IL + process isolation** | merged runner emits an `OutOfProcessTest`
that only calls `RunOutOfProcessTest(...)` on the generated run script,
and `ReferenceXUnitWrapperGenerator` is gated on `'$(Language)' == 'C#'`
so the IL assembly's hand-written `.entrypoint` never gets a wrapper
either | ❌ **nothing reads the attribute** |
In that last case only the MSBuild property puts the guard into the
generated `.cmd`/`.sh`.
`arrres_il_r` keeps its whole body in a single `Main`, so unoptimized
codegen (tier-0, minopts, JIT stress) keeps the `Test` objects alive in
untracked stack slots for the duration of `Main`. They are then never
finalized and never resurrected, and the test throws. It fails on every
default (tiered) run, which is why it lit up across outerloop, jitstress
and pgo on all platforms at once.
## Fix
Restore the MSBuild property on the two affected tests (option 1 from
#126108 (comment)):
- `arrres_il_r.ilproj` → `<JitOptimizationSensitive>`
- `b143840.ilproj` → `<GCStressIncompatible>` (same bug, unguarded on
gcstress legs; it kept `<RequiresProcessIsolation>` for
`<UnloadabilityIncompatible>`)
The `[SkipOnCoreClr]` attributes are intentionally left in place, so the
guard keeps working if either test ever stops requiring process
isolation. Each project gets a comment explaining why the property
cannot be dropped in favour of the attribute.
## Fallout audit
I enumerated all 16 IL tests carrying `[SkipOnCoreClr]` and evaluated
each owning project's *effective* `RequiresProcessIsolation` with
`msbuild -getProperty` (so inherited `Directory.Build.props`/`.targets`
values are accounted for). These two are the only process-isolated ones
— the other 14 are in-process and unaffected.
I also confirmed empirically, rather than by inspection alone, that both
of the "honored" rows above really do emit the guard, by disassembling
the built assemblies:
- `Directed_3.dll` (merged runner, in-process IL) contains `IsJitStress`
/ `IsJitStressRegs` / `IsJitMinOpts` / `IsTailCallStress` /
`IsTieredCompilation` checks guarding the call to
`[AttributeConflict]P::Main()`.
- `ObjectStackAllocationTests.dll` (process-isolated C#) contains the
same checks inside `__GeneratedMainWrapper`.
No C# test is affected by this class of bug.
## Validation
Built and ran the generated run scripts on windows-x64 checked:
```
arrres_il_r default (tiered) SKIP
TieredCompilation=0 PASS (Test passed., 100)
TC=0 + JITMinOpts=1 SKIP
TC=0 + JitStress=2 SKIP
b143840 default PASS
GCStress=0xC SKIP
```
Before the change, `arrres_il_r` reproduced the exact CI signature under
the default environment: unhandled `System.Exception` in
`GCTest_arrres_il.Test.Main`, exit `-532462766`.
cc @jkoritzinsky@jakobbotsch@JulieLeeMSFT
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a984328a-8b6c-4221-b2c9-d668eae5b505
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants

@MichalStrehovsky@jkoritzinsky@EgorBo