Skip to content

Conversation

@MichalStrehovsky
Copy link
Member

To the same tune as #122450. This is a bug farm, as expected, but likely still better than trying to teach the code that is shared with ILLink and Roslyn analyzer about async variants.

Cc @dotnet/ilc-contrib

To the same tune as dotnet#122450. This is a bug farm, as expected, but likely still better than trying to teach the code that is shared with ILLink and Roslyn analyzer about async variants.
@dotnet-policy-service
Copy link
Contributor

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

Copy link
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

This PR fixes a bug in dataflow analysis where lambdas and local functions within async methods were not being properly analyzed. The fix unwraps AsyncMethodVariant instances to their target methods before performing compiler-generated member analysis, following the same pattern used elsewhere in the codebase for handling async variants.

Key Changes

  • Added logic to unwrap AsyncMethodVariant to its target method in the dataflow analysis path
  • Added test coverage for async methods containing local async methods with dataflow warnings

Reviewed changes

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

File Description
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/CompilerGeneratedState.cs Added AsyncMethodVariant unwrapping logic in TryGetUserMethodForCompilerGeneratedMember to properly resolve user methods for compiler-generated members in async contexts
src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/RuntimeAsyncMethods.cs Added test case RuntimeAsyncWithAwaitedLocalMethod to verify dataflow warnings are correctly emitted for local async methods, and added System.Reflection using directive

@MichalStrehovsky MichalStrehovsky merged commit 9b0602a into dotnet:main Dec 22, 2025
123 of 126 checks passed
@MichalStrehovsky MichalStrehovsky deleted the anotherasyncdataflow branch December 22, 2025 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-NativeAOT-coreclr linkable-framework Issues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants