Share via


MarshalObjectiveCExceptionMode Enum

Definition

This enum is used to specify what to do when an Objective-C exception is thrown, and that exception reaches managed code.

public enum MarshalObjectiveCExceptionMode
type MarshalObjectiveCExceptionMode = 
Inheritance
MarshalObjectiveCExceptionMode

Fields

Name Value Description
Default 0

The default mode. This is currently the same as ThrowManagedException.

UnwindManagedCode 1

Let the Objective-C runtime unwind managed frames.

This option is not recommended, because it leads to undefined behavior (the app may crash, leak memory, deadlock, etc.) if Objective-C exceptions are thrown (the Objective-C runtime does not know how to unwind managed frames, so anything can happen). The recommended option is ThrowManagedException.

ThrowManagedException 2

Convert the Objective-C exception to a managed exception. This is the recommended option (and also the default behavior).

Abort 3

Abort when an Objective-C exception reaches managed code. This may be useful during debugging to easily detect when Objective-C exceptions are thrown.

Disable 4

Disable marshalling Objective-C exceptions. This is effectively the same as UnwindManagedCode, except that no events will be raised.

Applies to