Observed while enabling rt async in Libraires partition - #119432
The symptom is the number of tests failing with assert like:
Assert failure(PID 62300 [0x0000f35c], Thread: 12816 [0x3210]): Assertion failed '!varTypeIsStruct(node) && !varTypeIsStruct(type)' in 'System.IO.Stream:ReadAsync(System.Memory
1[byte],System.Threading.CancellationToken):int:this' during 'Importation' (IL size 40; hash 0xaffe5a9c; FullOpts)
`
ValueTask-returning methods need slightly different shape of the thunk. In particular - we can't just callvirt GetAwaiter on the result of the warapped call when it returns a ValueTask
. Since it is a struct, we need to do stloc; ldloca
.
An approximate fix is in: 0803d39