diff options
Diffstat (limited to 'src/coreclr/tools/Common/TypeSystem/IL/Stubs/PInvokeILEmitter.cs')
-rw-r--r-- | src/coreclr/tools/Common/TypeSystem/IL/Stubs/PInvokeILEmitter.cs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/PInvokeILEmitter.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/PInvokeILEmitter.cs index 57f724815fb..b1bbb25130f 100644 --- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/PInvokeILEmitter.cs +++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/PInvokeILEmitter.cs @@ -345,6 +345,13 @@ namespace Internal.IL.Stubs InteropTypes.GetPInvokeMarshal(context) .GetKnownMethod("SaveLastError", null))); } + + if (MarshalHelpers.ShouldCheckForPendingException(context.Target, _pInvokeMetadata)) + { + MetadataType lazyHelperType = context.SystemModule.GetKnownType("System.Runtime.InteropServices.ObjectiveC", "ObjectiveCMarshal"); + callsiteSetupCodeStream.Emit(ILOpcode.call, emitter.NewToken(lazyHelperType + .GetKnownMethod("ThrowPendingExceptionObject", null))); + } } private void EmitCalli(PInvokeILCodeStreams ilCodeStreams, CalliMarshallingMethodThunk calliThunk) |