Skip to content

Extend async override virtual call coverage#128313

Open
Copilot wants to merge 1 commit into
mainfrom
copilot/extend-test-coverage-await-methods
Open

Extend async override virtual call coverage#128313
Copilot wants to merge 1 commit into
mainfrom
copilot/extend-test-coverage-await-methods

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 18, 2026

Adds coverage for awaited virtual dispatch and generic virtual async overrides in src/tests/async/override/override.cs.

  • Awaited virtual calls

    • Adds NoInlining helpers that await Base.M1() and Base1.M1().
    • Exercises both direct .Result virtual calls and awaited wrapper calls.
  • Generic virtual async overrides

    • Adds M2<T>(T first, T second) across both override hierarchies.
    • Verifies dispatch returns:
      • empty list from base implementations
      • first argument from first-level overrides
      • second argument from second-level overrides
[MethodImpl(MethodImplOptions.NoInlining)]
static async Task<List<T>> AwaitBaseM2<T>(Base b, T first, T second) =>
    await b.M2(first, second);

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/f0cdee65-d4c1-4916-bbd3-9dcb4dcfe398

Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
@MichalStrehovsky
Copy link
Copy Markdown
Member

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke
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

This PR expands the src/tests/async/override/override.cs async-override test coverage by adding an awaited-call wrapper path and introducing a generic virtual async method (M2<T>) with overrides across two class hierarchies.

Changes:

  • Add M2<T>(T first, T second) as a virtual async method on both Base and Base1, with overrides in derived types returning lists that reflect dispatch selection.
  • Add [NoInlining] async helper wrappers that await virtual calls (AwaitBaseM1 / AwaitBaseM2) to exercise awaited virtual dispatch call sites.
  • Extend assertions to validate both direct .Result calls and the awaited-wrapper paths for overridden implementations.

Comment on lines 121 to 126
Base b = new Derived1();
Assert.Equal(2, b.M1().Result);
Assert.Equal(2, AwaitBaseM1(b).Result);
Assert.Equal(new List<int> { 2 }, b.M2(2, 3).Result);
Assert.Equal(new List<int> { 2 }, AwaitBaseM2(b, 2, 3).Result);

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.

6 participants