Interface INativeExceptionHelper
A native exception helper to enable interop with native code that throws exceptions.
public interface INativeExceptionHelper
Remarks
This helper must only be used when native->managed->native transitions are present. If the only transition is managed->native, this helper cannot be used.
This helper can only propagate exceptions, not catch them permanently.
Use CreateNativeToManagedHelper(nint, out IDisposable?) to generate a thunk which should be used at the native->managed transition. This will rethrow the exception on the current thread, if there is one. Similarly, use CreateManagedToNativeHelper(nint, out IDisposable?) to generate a thunk to use at the managed->native transition. This thunk will catch exceptions which are thrown in the native code, and store them in a thread local associated with the exception helper.
Properties
- GetExceptionSlot
- Gets a delegate which can be used to get a pointer to the current thread's native exception slot.
Methods
- CreateManagedToNativeHelper(nint, out IDisposable?)
- Creates a managed to native thunk for this exception helper.
- CreateNativeToManagedHelper(nint, out IDisposable?)
- Creates a native to managed thunk for this exception helper.