Explorar el Código

Move more COM exceptions to shared partition (dotnet/corert#6829)

Signed-off-by: dotnet-bot <[email protected]>
Marek Safar hace 7 años
padre
commit
c404a499ad

+ 5 - 0
netcore/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" />

+ 41 - 0
netcore/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)
+        {
+        }
+    }
+}

+ 40 - 0
netcore/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)
+        {
+        }
+    }
+}

+ 48 - 0
netcore/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;
+    }
+}

+ 39 - 0
netcore/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)
+        {
+        }
+    }
+}

+ 39 - 0
netcore/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)
+        {
+        }
+    }
+}