diff options
Diffstat (limited to 'src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeWrappedException.cs')
-rw-r--r-- | src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeWrappedException.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeWrappedException.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeWrappedException.cs new file mode 100644 index 0000000000..e4af9be678 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeWrappedException.cs @@ -0,0 +1,33 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.Serialization; + +namespace System.Runtime.CompilerServices +{ + /// <summary> + /// Exception used to wrap all non-CLS compliant exceptions. + /// </summary> + public sealed class RuntimeWrappedException : Exception + { + private Object _wrappedException; // EE expects this name + + // Not an api but has to be public as System.Linq.Expression invokes this through Reflection when an expression + // throws an object that doesn't derive from Exception. + public RuntimeWrappedException(Object thrownObject) + : base(SR.RuntimeWrappedException) + { + HResult = HResults.COR_E_RUNTIMEWRAPPED; + _wrappedException = thrownObject; + } + + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + base.GetObjectData(info, context); + } + + public Object WrappedException => _wrappedException; + } +} |