Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Compilation/ILCompiler.AsyncGenerators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,12 @@

// #725: instantiate the function display class and seed any captured-and-mutated parameter
// into it (instance methods carry 'this' at arg 0, so user params start at arg 1). The stub
// params are typed, so value types are boxed before the store. No-op when no function DC.
// params are typed, so value types are boxed before the store. No-op when no function DC. Pass
// the CLR boxing types from the method's ACTUAL IL signature (same source as the field-seeding
// loop above), so widened/all-object slots are not spuriously boxed.
if (funcDCKey != null)
EmitGeneratorFunctionDCInit(il, smBuilder.FunctionDCField, method, funcDCKey, paramOffset: 1, paramTypes);
EmitGeneratorFunctionDCInit(il, smBuilder.FunctionDCField, method, funcDCKey, paramOffset: 1,
paramTypes.Select(p => p.ParameterType).ToArray());

Check failure on line 379 in Compilation/ILCompiler.AsyncGenerators.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Argument 6: cannot convert from 'System.Type[]' to 'System.Reflection.ParameterInfo[]?'

Check failure on line 379 in Compilation/ILCompiler.AsyncGenerators.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Argument 6: cannot convert from 'System.Type[]' to 'System.Reflection.ParameterInfo[]?'

// Return the state machine (which implements IAsyncEnumerable<object>)
il.Emit(OpCodes.Ret);
Expand Down
7 changes: 5 additions & 2 deletions Compilation/ILCompiler.Generators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,13 @@
// into it so an arrow that writes that parameter shares the generator's storage. Instance
// methods carry 'this' at arg 0, so user params start at arg 1 (paramOffset: 1). The stub
// params are typed, so EmitGeneratorFunctionDCInit boxes value types before the store. No-op
// when the method has no function DC.
// when the method has no function DC. Pass the CLR boxing types from the method's ACTUAL IL
// signature (same source as the field-seeding loop above), so widened/all-object slots are not
// spuriously boxed.
if (funcDCKey != null)
EmitGeneratorFunctionDCInit(il, smBuilder.FunctionDCField, method, funcDCKey, paramOffset: 1, paramTypes);
EmitGeneratorFunctionDCInit(il, smBuilder.FunctionDCField, method, funcDCKey, paramOffset: 1,
paramTypes.Select(p => p.ParameterType).ToArray());

Check failure on line 561 in Compilation/ILCompiler.Generators.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Argument 6: cannot convert from 'System.Type[]' to 'System.Reflection.ParameterInfo[]?'

Check failure on line 561 in Compilation/ILCompiler.Generators.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Argument 6: cannot convert from 'System.Type[]' to 'System.Reflection.ParameterInfo[]?'
// Captured outer-scope variables are NOT copied into the state machine (#541): see the
// free-function stub above. MoveNext reads/writes them live from their backing storage,
// wired through the CompilationContext in EmitGeneratorMethodBody.
Expand Down
Loading