RuntimeCompatibilityAttribute.WrapNonExceptionThrows Property

Note: This property is new in the .NET Framework version 2.0.

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

Namespace: System.Runtime.CompilerServices
Assembly: mscorlib (in mscorlib.dll)

public bool WrapNonExceptionThrows { get; set; }
/** @property */
public boolean get_WrapNonExceptionThrows ()

/** @property */
public void set_WrapNonExceptionThrows (boolean value)

public function get WrapNonExceptionThrows () : boolean

public function set WrapNonExceptionThrows (value : boolean)

Property Value

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

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;
}

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0
Show: