Draft
Add runtime-async varargs testcase and treat vararg Task-returning methods as normal methods#130509
Conversation
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-threading-tasks |
…ormal Co-authored-by: VSadov <8218165+VSadov@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add testcase for Task-returning methods using __arglist
Add runtime-async varargs testcase and treat vararg Task-returning methods as normal methods
Jul 10, 2026
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.
__arglist(vararg calling convention) is an unsupported combination with runtime-async. Previously anasyncMethodImpl vararg method could produce a broken async thunk (crash/UB), and there was no coverage for vararg Task/ValueTask methods. The goal is "don't crash on scenarios that used to work."Runtime change (
src/coreclr/vm/methodtablebuilder.cpp)In
EnumerateClassMethods, before async-variant creation, classify vararg Task/ValueTask-returning methods deterministically:NormalMethod, so no async variant is generated and it behaves exactly as before.asyncMethodImpl vararg method → throwsIDS_EE_VARARG_NOT_SUPPORTED(TypeLoadException) at type load instead of emitting a broken thunk.Test (
src/tests/async/varargs/varargs.il+varargs.ilproj)Authored in IL because Roslyn rejects
__arglistin async methods under runtime-async (CS9328).ArgIterator): validated via direct call and viaawaitfrom a runtime-async wrapper.asyncvararg Task/ValueTask methods: asserting the declaring type fails to load withTypeLoadException.OperatingSystem.IsWindows(), since managed varargs are Windows-only (compFeatureVarArg,src/coreclr/jit/target.h); non-Windows platforms skip without jitting a vararg instruction.Validation notes
The positive vararg paths cannot be exercised on Linux (managed
__arglistis unsupported off-Windows — the JIT emitsBADCODE), hence the Windows runtime gating; those paths depend on Windows CI for full validation. The runtime fix compiles cleanly.