Skip to content

Avoid stripping IL of non-async Task-returning methods#129884

Open
jakobbotsch wants to merge 1 commit into
dotnet:mainfrom
jakobbotsch:fix-129813
Open

Avoid stripping IL of non-async Task-returning methods#129884
jakobbotsch wants to merge 1 commit into
dotnet:mainfrom
jakobbotsch:fix-129813

Conversation

@jakobbotsch

Copy link
Copy Markdown
Member

The IL of these may be needed at runtime to compile async versions.

The IL of these may be needed at runtime to compile async versions.

Copilot AI 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.

Pull request overview

This change updates ReadyToRun IL body stripping so the compiler retains real IL for methods whose IL may be needed at runtime (notably synchronous Task/ValueTask-returning methods that can have async variants), instead of replacing their bodies with the minimal throwing stub when --strip-il-bodies is enabled.

Changes:

  • Replaces the previous “non-generic only” strip condition with a helper (MayNeedILAtRuntime) that centralizes the decision.
  • Preserves IL for generic methods/types (existing behavior) and additionally for non-async Task/ValueTask-returning methods.

@jakobbotsch

Copy link
Copy Markdown
Member Author

Once the crossgen2 support makes it in we could also consider being a bit more precise -- we can strip the IL body if we have compiled both the async and non-async variants.

@jkotas jkotas added runtime-async area-ReadyToRun and removed area-crossgen2-coreclr only use for closed issues labels Jun 26, 2026
@jkotas jkotas marked this pull request as ready for review June 26, 2026 18:01
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