RuntimeCompatibilityAttribute.WrapNonExceptionThrows Property

 

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 Value

Type: System.Boolean

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

Universal Windows Platform
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: