Skip to content

Conversation

jtschuster
Copy link
Member

Fixes #120340

Adds test with some rutnime async methods, and fixes the check for invalid IL when a Task returning async method doesn't have a value on the stack for ret.

@jtschuster jtschuster requested review from Copilot and sbomer October 14, 2025 00:34
@github-actions github-actions bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Oct 14, 2025
Copy link
Contributor

@Copilot 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

This PR adds support for runtime async methods in the linker's dataflow analysis and test infrastructure. It fixes an issue where the linker would incorrectly validate IL for runtime async methods that return Task but don't have a value on the stack for the ret instruction.

Key changes:

  • Adds test infrastructure support for /features and /nowarn compiler arguments
  • Creates comprehensive test cases for runtime async methods with various dataflow scenarios
  • Updates method body scanner to handle runtime async methods correctly

Reviewed Changes

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

File Description
TestCaseCompiler.cs Adds support for /features and /nowarn compiler arguments in test compilation
RuntimeAsyncMethods.cs New test file with comprehensive coverage of runtime async method dataflow scenarios
MethodDefinitionExtensions.cs Adds IsRuntimeAsync() extension method to detect runtime async methods
MethodBodyScanner.cs Updates IL validation logic to handle runtime async methods that don't have return values on stack

features.Add(feature[..featureSplit], feature[(featureSplit + 1)..]);
break;
}
else if(splitIndex != -1 && option[..splitIndex] == "/nowarn")
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

Missing space after 'if' keyword. Should be 'else if (' to maintain consistent formatting with the rest of the codebase.

Suggested change
else if(splitIndex != -1 && option[..splitIndex] == "/nowarn")
else if (splitIndex != -1 && option[..splitIndex] == "/nowarn")

Copilot uses AI. Check for mistakes.

@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label Oct 14, 2025
Copy link
Contributor

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

Copy link
Member

@agocke agocke left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Tools-ILLink .NET linker development as well as trimming analyzers linkable-framework Issues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RuntimeAsync] Mono.Linker detects invalid IL in async methods.

2 participants