diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.cs index b12db35c7b59e8..cba7f51a757b6f 100644 --- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.cs +++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.cs @@ -323,11 +323,11 @@ public override MethodIL EmitIL() // ldarg.0 (this pointer) // ldfld Delegate._helperObject - // castclass Delegate.Wrapper[] + // castclass Delegate.Wrapper[] (omitted - generate unsafe cast assuming the delegate is well-formed) // stloc delegateArrayLocal codeStream.EmitLdArg(0); codeStream.Emit(ILOpcode.ldfld, emitter.NewToken(HelperObjectField)); - codeStream.Emit(ILOpcode.castclass, emitter.NewToken(invocationListArrayType)); + // codeStream.Emit(ILOpcode.castclass, emitter.NewToken(invocationListArrayType)); codeStream.EmitStLoc(delegateArrayLocal); // Fill in invocationCountLocal diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Compilation.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Compilation.cs index 6a542d8d00a748..8b6bf4a8664698 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Compilation.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Compilation.cs @@ -436,8 +436,12 @@ public bool IsFatPointerCandidate(MethodDesc containingMethod, MethodSignature s return false; // Delegate invocation never needs fat calls - if (owningType.IsDelegate && containingMethod.Name == "Invoke") - return false; + if (owningType.IsDelegate) + { + string methodName = containingMethod.Name; + if (methodName == "Invoke" || methodName == "InvokeMulticastThunk") + return false; + } } return true;