แก้ไข

แชร์ผ่าน


RuntimeCompatibilityAttribute.WrapNonExceptionThrows Property

Definition

Gets or sets a value that indicates whether to wrap exceptions that do not derive from the Exception class with a RuntimeWrappedException object.

public:
 property bool WrapNonExceptionThrows { bool get(); void set(bool value); };
public bool WrapNonExceptionThrows { get; set; }
member this.WrapNonExceptionThrows : bool with get, set
Public Property WrapNonExceptionThrows As Boolean

Property Value

true if exceptions that do not derive from the Exception class should appear wrapped with a RuntimeWrappedException object; otherwise, false.

Examples

The following code example applies the RuntimeCompatibilityAttribute attribute to an assembly to disable exception wrapping.

using namespace System;
using namespace System::Runtime::CompilerServices;

[assembly:RuntimeCompatibilityAttribute(WrapNonExceptionThrows = false)];

void run()
{
     Console::WriteLine("The RuntimeCompatibilityAttribute was applied to disable exception wrapping.");
}

int main()
{
    run();

    return 0;
}

Applies to