Skip to content

Keep invalid type references live in Loader negative tests - #136540

Merged
lewing merged 2 commits into
mainfrom
lewing-wasm-static-virtual-failures
Oct 28, 2026
Merged

lewing merged 2 commits into
mainfrom
lewing-wasm-static-virtual-failures

Conversation

@lewing

@lewing lewing commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Since #135802, ReadyToRun no longer emits restoration fixups for type tokens that the JIT folds away. Several Loader negative tests relied on an unused type reference to trigger a TypeLoadException. Under R2R that reference is gone, so the exception never fires:

  • MethodFlags, UnimplementedAbstractMethodOnConcreteClass, VarianceSafety: ldtoken X; pop
  • InternalMethodImplTest: var f2 = new F2(); with the result unused

As @jkotas noted on #136494, the new behavior is acceptable: we don't guarantee identical behavior for invalid IL or metadata across codegen strategies. This PR updates the tests so the type reference is actually used. The ldtoken result now goes through Statics.MakeName(RuntimeTypeHandle), and new F2() is passed to GC.KeepAlive.

TypeHierarchyTest, TypeHierarchyTest_minimal, MultipleMethodImplRecordsSameMethodDecl and UnimplementedAbstractMethodOnAbstractClass are left unchanged. #136494 attributes their failures to the failure count MethodFlags carries over in the merged runner.

Validation

On osx-arm64 Checked, after ./build.sh clr+libs -lc release -rc checked, I built each test with src/tests/build.sh -Test <proj> -priority1 checked. I then R2R-compiled the test and its dependencies with Core_Root's crossgen2 and ran it with corerun:

Test Before After
MethodFlags 2 failures passed (0 failures)
UnimplementedAbstractMethodOnConcreteClass not run passed
VarianceSafety not run passed
InternalMethodImplTest exit 101 exit 100

In JIT mode, MethodFlags and InternalMethodImplTest passed before and after the change. I didn't run the four unchanged tests above, the WASI leg, or composite mode.

Resolves #136494
Resolves #136534

Note

This PR description was drafted with GitHub Copilot.

Since #135802, ReadyToRun no longer emits restoration fixups for type
tokens the JIT folds away, so tests that relied on `ldtoken X; pop` or a
dead `new F2()` to trigger a TypeLoadException stopped throwing under R2R.
Consume the references so the type load still happens.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@lewing
lewing enabled auto-merge (squash) October 27, 2026 20:36
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@lewing

lewing commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

/ba-g mac storage account auth failures are unrelated

@lewing
lewing merged commit 8cf4609 into main Oct 28, 2026
79 of 82 checks passed
@lewing
lewing deleted the lewing-wasm-static-virtual-failures branch October 28, 2026 01:55
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Static Abstract/Virtual method failures on browser-wasm ReadyToRun: StaticVirtualMethods and InternalMethodImpl Loader tests fail since #135802

3 participants