Fix #3777: decompile runtime async without a separate C# 15 setting#3791
Merged
Conversation
Runtime async is a compiler feature that emits ordinary async/await (a C# 5 construct), so reconstructing it should not require selecting C# 15. The dedicated RuntimeAsync setting was also redundant: AsyncAwaitDecompiler already runs the runtime-async transforms only when AsyncAwait is enabled. Fold the behavior into the AsyncAwait setting and drop the separate toggle. Assisted-by: Claude:claude-opus-4-8:Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3777.
Runtime async is a compiler feature, not a language feature: there is no
dotnet/csharplangspec for it, and Roslyn emits it even in older language versions when enabled. ILSpy decompiles runtime-async methods back into ordinaryasync/await, which is a C# 5 construct. Gating that reconstruction on C# 15 needlessly produced worse output whenever a lower language version was selected.Rather than just re-gate the toggle to C# 5, this removes the standalone
RuntimeAsyncsetting entirely and folds its behavior into the existingAsyncAwait("Decompile async methods") setting. The separate toggle was redundant:AsyncAwaitDecompiler.Runalready early-returns whenAsyncAwaitis disabled, so the runtime-async transforms were always nested inside that gate. Runtime async now follows the single async/await toggle, exactly like state-machine async.Changes
RuntimeAsyncproperty fromDecompilerSettings(plus its C# 15 version-gating inSetLanguageVersion/GetMinimumRequiredVersion) and its resource string.DecompilerTypeSystem.GetOptions,AsyncAwaitDecompiler,EarlyExpressionTransforms) throughAsyncAwait.Notes
RuntimeAsyncattribute in saved settings is silently ignored on load; no migration needed.Testing
RuntimeAsync*pretty tests locally (RuntimeAsync,RuntimeAsyncForeach,RuntimeAsyncMain,RuntimeAsyncStreams,RuntimeAsyncUsing,RuntimeAsyncCustomTaskType): all 12 cases pass.