C# 10 allows [AsyncMethodBuilder(typeof(...))] directly on an async
method (also on local functions and explicit-return-type lambdas) to
override the builder that the return type's canonical builder would
otherwise dictate. The fixture covers overrides returning Task, Task<T>,
ValueTask and ValueTask<T> (via the BCL pooling builders), struct vs
class builders, an open-generic builder on a generic method, capture of
this, await-free bodies, awaits in loops, a local function and a lambda.
The test is Assert.Ignore'd because AsyncAwaitDecompiler rejects any
state machine whose Start call's builder type differs from the builder
derived from the return type (TaskType.IsNonGenericTaskType/
IsGenericTaskType), so every overridden method decompiles as a raw
kickoff body plus the untransformed MoveNext state machine, which does
not recompile. The method-level attribute itself is correctly preserved
in metadata output; only the async-transform recognition is missing.
All four Roslyn 4.14/latest debug/opt configs compile the fixture and
fail only at the output comparison. The builder scaffolding in the
fixture is verbatim ILSpy output (verified by decompiling a probe
assembly), so only the async method bodies are the desired-output spec.
Assisted-by: Claude:claude-fable-5:Claude Code