question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should GenAPI be removing the AsyncMethodBuilder attribute?

See original GitHub issue

See https://github.com/dotnet/corefx/pull/35557#discussion_r259772806

This attribute is required to avoid compiler errors (for verifying that async methods return a task-like type), but it is being excluded here: https://github.com/dotnet/corefx/blob/26b932e3c56702382d13ece010b300d3181d2891/eng/DefaultGenApiDocIds.txt#L53

error CS1983: The return type of an async method must be void, Task, Task<T>, a task-like type, IAsyncEnumerable<T>, or IAsyncEnumerator<T>

Given that behaviour, we should consider removing the exclusion from the list.

cc @jaredpar, @ericstj, @stephentoub

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
stephentoubcommented, Feb 26, 2019

It must not remove it. This is a key part of using arbitrary task-like types as the return type of an async method. It’s more than just a compiler error: the reason for the error is the compiler needs to know what builder to use for that type as part of compiling the method.

0reactions
ericstjcommented, Jun 24, 2019

I’m ok with tracking this in arcade, since currently the reference is up to date. Here’s the PR where I tried to enable this: https://github.com/dotnet/corefx/pull/37482

Read more comments on GitHub >

github_iconTop Results From Across the Web

AsyncMethodBuilder override - C# 10.0 draft feature ...
This feature specification describes new rules to enable types to override the default AsyncMethodBuilder. This will be used by the runtime ...
Read more >
c# - Why does my async method builder have to be a class ...
The Task property and the SetResult method both execute concurrently; The SpinLock does not mutually exclude the respective blocks of code (they ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found