Add runtime-async varargs testcase and treat vararg Task-returning methods as normal methods#130509
Conversation
|
Tagging subscribers to this area: @dotnet/area-system-threading-tasks |
…ormal Co-authored-by: VSadov <8218165+VSadov@users.noreply.github.com>
|
@copilot there are test failures like: |
Co-authored-by: VSadov <8218165+VSadov@users.noreply.github.com>
... Fixed in b7c... — this was an ILAsm authoring bug in the test, not a runtime issue. The four vararg method definitions were written as The fix moves
The vararg call still throws Note This comment was generated by GitHub Copilot. |
|
@copilot there are still failures (perhaps new ones) in the last iteration: |
…rom async methods Co-authored-by: VSadov <8218165+VSadov@users.noreply.github.com>
... Fixed both failures — both were IL-authoring bugs in the test, not runtime issues.
Verified Note This comment was generated by GitHub Copilot. |
|
@copilot there is a failure in one of the scenarios: Can this be a test issue or it is a real product bug? |
... My read: this is a real product bug, not a test bug (the expected value is correct: 100+30+7 = 137). The four scenarios now isolate the variable cleanly:
So the only thing unique to the failing case is: awaiting a synchronously-completed The symptom points at the culprit: it returns a wrong value rather than throwing/crashing. If Two cheap experiments to pin it down (both need Windows since managed varargs are Windows-only):
I can't run either here (these paths Note This comment was generated by GitHub Copilot. |
__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.