diff options
author | Marek Safar <marek.safar@gmail.com> | 2019-01-16 00:32:58 +0100 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2019-01-15 18:12:29 -0800 |
commit | a8ff2a7420864f6fe363cf106813c6368542821a (patch) | |
tree | 5ef81fbd7c0d29bd1ed848509c85f6143d6f03ed /src | |
parent | a4a45721628a0a5721c57be4e230cda37bb3b8b9 (diff) | |
download | coreclr-a8ff2a7420864f6fe363cf106813c6368542821a.tar.gz coreclr-a8ff2a7420864f6fe363cf106813c6368542821a.tar.bz2 coreclr-a8ff2a7420864f6fe363cf106813c6368542821a.zip |
Move more COM exceptions to shared partition (dotnet/corert#6829)
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Diffstat (limited to 'src')
6 files changed, 212 insertions, 0 deletions
diff --git a/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems b/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems index 5700d5569e..d28a53ff17 100644 --- a/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems +++ b/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems @@ -614,6 +614,8 @@ <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\ICustomMarshaler.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\ICustomQueryInterface.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\InAttribute.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\InvalidComObjectException.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\InvalidOleVariantTypeException.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\InterfaceTypeAttribute.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\LCIDConversionAttribute.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\LayoutKind.cs" /> @@ -626,7 +628,10 @@ <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\OutAttribute.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\PreserveSigAttribute.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\ProgIdAttribute.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\SafeArrayRankMismatchException.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\SafeArrayTypeMismatchException.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\SafeBuffer.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\SEHException.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\StructLayoutAttribute.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\TypeIdentifierAttribute.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\UnknownWrapper.cs" /> diff --git a/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/InvalidComObjectException.cs b/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/InvalidComObjectException.cs new file mode 100644 index 0000000000..32c78e9902 --- /dev/null +++ b/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/InvalidComObjectException.cs @@ -0,0 +1,41 @@ +// 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.Runtime.Serialization; + +namespace System.Runtime.InteropServices +{ + /// <summary> + /// The exception thrown when an invalid COM object is used. This happens + /// when a the __ComObject type is used directly without having a backing + /// class factory. + /// </summary> + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public class InvalidComObjectException : SystemException + { + public InvalidComObjectException() + : base(SR.Arg_InvalidComObjectException) + { + HResult = HResults.COR_E_INVALIDCOMOBJECT; + } + + public InvalidComObjectException(String message) + : base(message) + { + HResult = HResults.COR_E_INVALIDCOMOBJECT; + } + + public InvalidComObjectException(String message, Exception inner) + : base(message, inner) + { + HResult = HResults.COR_E_INVALIDCOMOBJECT; + } + + protected InvalidComObjectException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } + } +} diff --git a/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/InvalidOleVariantTypeException.cs b/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/InvalidOleVariantTypeException.cs new file mode 100644 index 0000000000..09397dceef --- /dev/null +++ b/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/InvalidOleVariantTypeException.cs @@ -0,0 +1,40 @@ +// 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.Runtime.Serialization; + +namespace System.Runtime.InteropServices +{ + /// <summary> + /// Exception thrown when the type of an OLE variant that was passed into the + /// runtime is invalid. + /// </summary> + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public class InvalidOleVariantTypeException : SystemException + { + public InvalidOleVariantTypeException() + : base(SR.Arg_InvalidOleVariantTypeException) + { + HResult = HResults.COR_E_INVALIDOLEVARIANTTYPE; + } + + public InvalidOleVariantTypeException(String message) + : base(message) + { + HResult = HResults.COR_E_INVALIDOLEVARIANTTYPE; + } + + public InvalidOleVariantTypeException(String message, Exception inner) + : base(message, inner) + { + HResult = HResults.COR_E_INVALIDOLEVARIANTTYPE; + } + + protected InvalidOleVariantTypeException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } + } +} diff --git a/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/SEHException.cs b/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/SEHException.cs new file mode 100644 index 0000000000..f62f9e9dc6 --- /dev/null +++ b/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/SEHException.cs @@ -0,0 +1,48 @@ +// 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.Runtime.Serialization; + +namespace System.Runtime.InteropServices +{ + /// <summary> + /// Exception for Structured Exception Handler exceptions. + /// </summary> + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public class SEHException : ExternalException + { + public SEHException() + : base() + { + HResult = HResults.E_FAIL; + } + + public SEHException(String message) + : base(message) + { + HResult = HResults.E_FAIL; + } + + public SEHException(String message, Exception inner) + : base(message, inner) + { + HResult = HResults.E_FAIL; + } + + protected SEHException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } + + // Exceptions can be resumable, meaning a filtered exception + // handler can correct the problem that caused the exception, + // and the code will continue from the point that threw the + // exception. + // + // Resumable exceptions aren't implemented in this version, + // but this method exists and always returns false. + // + public virtual bool CanResume() => false; + } +} diff --git a/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/SafeArrayRankMismatchException.cs b/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/SafeArrayRankMismatchException.cs new file mode 100644 index 0000000000..95781a7b07 --- /dev/null +++ b/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/SafeArrayRankMismatchException.cs @@ -0,0 +1,39 @@ +// 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.Runtime.Serialization; + +namespace System.Runtime.InteropServices +{ + /// <summary> + /// The exception is thrown when the runtime rank of a safe array is different + /// than the array rank specified in the metadata. + /// </summary> + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public class SafeArrayRankMismatchException : SystemException + { + public SafeArrayRankMismatchException() + : base(SR.Arg_SafeArrayRankMismatchException) + { + HResult = HResults.COR_E_SAFEARRAYRANKMISMATCH; + } + + public SafeArrayRankMismatchException(String message) + : base(message) + { + HResult = HResults.COR_E_SAFEARRAYRANKMISMATCH; + } + + public SafeArrayRankMismatchException(String message, Exception inner) + : base(message, inner) + { + HResult = HResults.COR_E_SAFEARRAYRANKMISMATCH; + } + + protected SafeArrayRankMismatchException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } + } +} diff --git a/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/SafeArrayTypeMismatchException.cs b/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/SafeArrayTypeMismatchException.cs new file mode 100644 index 0000000000..c4257dcffd --- /dev/null +++ b/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/SafeArrayTypeMismatchException.cs @@ -0,0 +1,39 @@ +// 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.Runtime.Serialization; + +namespace System.Runtime.InteropServices +{ + /// <summary> + /// The exception is thrown when the runtime type of an array is different + /// than the safe array sub type specified in the metadata. + /// </summary> + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public class SafeArrayTypeMismatchException : SystemException + { + public SafeArrayTypeMismatchException() + : base(SR.Arg_SafeArrayTypeMismatchException) + { + HResult = HResults.COR_E_SAFEARRAYTYPEMISMATCH; + } + + public SafeArrayTypeMismatchException(String message) + : base(message) + { + HResult = HResults.COR_E_SAFEARRAYTYPEMISMATCH; + } + + public SafeArrayTypeMismatchException(String message, Exception inner) + : base(message, inner) + { + HResult = HResults.COR_E_SAFEARRAYTYPEMISMATCH; + } + + protected SafeArrayTypeMismatchException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } + } +} |