dotnet / dotnet/runtime

[RuntimeAsync] Handle covariant returns scenarios in combination with task-returning methods.

Open
#124,238 3 comments 1 reaction 2 assignees Claimed by @VSadov View on GitHub
area-VM-coreclr runtime-async
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

Re: https://github.com/dotnet/runtime/pull/124062 . The PR was a mitigation, but we need actual fixes.

There are two loosely related issues, which may require separate fixes:

- [x] `Task` inherits from `Task`.
As an example, when a covariant override returns `Task` vs. base method returning `Task` we may need two async variants for the overriding method - a real one (returns `Guid`) and a one that matches/overrides the base (calls the real variant, drops the return and returns `void`).

- [ ] both `Task` and `Task` are not sealed, so a covariant override may return something derived that is not a task at all.
At least in a case where the base was `MethodImpl.Async` we may need to emit an async variant (thunk) for the overriding method that matches the base, even though the overriding method is not technically task-returning.

Other solutions may exist.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.