Skip to content

Add test for non-async generic methods mismatch in ILC scanner/JIT #127782

Merged
MichalStrehovsky merged 7 commits into
dotnet:mainfrom
eduardo-vp:add-test-127179
May 14, 2026
Merged

Add test for non-async generic methods mismatch in ILC scanner/JIT #127782
MichalStrehovsky merged 7 commits into
dotnet:mainfrom
eduardo-vp:add-test-127179

Conversation

@eduardo-vp
Copy link
Copy Markdown
Member

@eduardo-vp eduardo-vp commented May 5, 2026

Adding test for #127179.

ILC crashes when trying to compile a runtime async method on a generic type that calls a non-async generic method. The JIT tries to use the async call method whereas the scanner only generated information for the thunk.

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new async regression test intended to cover #127179 by exercising a generic async ValueTask<T> method awaiting a non-async generic method, targeting an ILC scanner vs JIT expectation mismatch scenario.

Changes:

  • Introduces a new test project under src/tests/async/awaitingnoasyncgeneric/ using Microsoft.NET.Sdk.IL.
  • Adds a simple xUnit test that runs the pattern for both reference and value generic instantiations.
  • Forces optimization on in the test project to ensure the relevant scanning/codegen path is exercised.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/tests/async/awaitingnoasyncgeneric/awaitingnoasyncgeneric.csproj New test project with optimization + process isolation settings.
src/tests/async/awaitingnoasyncgeneric/awaitingnoasyncgeneric.cs New xUnit test and minimal repro pattern using generic ValueTask<T>.

Comment thread src/tests/async/awaitingnoasyncgeneric/awaitingnoasyncgeneric.cs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 5, 2026 02:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/tests/async/awaitingnoasyncgeneric/awaitingnoasyncgeneric.cs
Copy link
Copy Markdown
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

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

For the actual fix, I think we can start with a PR that gets rid of the guessing in ILScanner (the spot where we try to figure out whether to use the runtime async or non-runtime async entrypoint) - just report both dependencies. Once we have a PR doing that, we can do a measurement with https://github.com/MichalStrehovsky/rt-sz and take it from there.

Comment thread src/tests/async/awaitingnoasyncgeneric/awaitingnoasyncgeneric.csproj Outdated
Comment thread src/tests/async/awaitingnoasyncgeneric/awaitingnoasyncgeneric.csproj Outdated
Copilot AI review requested due to automatic review settings May 13, 2026 01:41

This comment was marked as outdated.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 13, 2026 20:26

This comment was marked as outdated.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 13, 2026 20:41

This comment was marked as outdated.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 13, 2026 20:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

@MichalStrehovsky MichalStrehovsky merged commit 863e48f into dotnet:main May 14, 2026
86 of 88 checks passed
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.

3 participants