diff options
author | Marek Safar <marek.safar@gmail.com> | 2019-01-10 20:01:43 +0100 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2019-01-10 13:44:57 -0800 |
commit | 15036527b060dccef9f3befe33af22346e6999cb (patch) | |
tree | c9566d7829b470306eeec388dd605afae60613ad | |
parent | 9fa4f2226c687317981f30eb1f49b82371c80bd6 (diff) | |
download | coreclr-15036527b060dccef9f3befe33af22346e6999cb.tar.gz coreclr-15036527b060dccef9f3befe33af22346e6999cb.tar.bz2 coreclr-15036527b060dccef9f3befe33af22346e6999cb.zip |
Move COMException to shared partition (dotnet/corert#6803)
* Move COMException to shared partition
* Review feedback
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
-rw-r--r-- | src/System.Private.CoreLib/System.Private.CoreLib.csproj | 1 | ||||
-rw-r--r-- | src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems | 1 | ||||
-rw-r--r-- | src/System.Private.CoreLib/shared/System/Runtime/InteropServices/COMException.cs (renamed from src/System.Private.CoreLib/src/System/Runtime/InteropServices/COMException.cs) | 32 |
3 files changed, 17 insertions, 17 deletions
diff --git a/src/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/System.Private.CoreLib/System.Private.CoreLib.csproj index 779688ee21..5111d69bef 100644 --- a/src/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -252,7 +252,6 @@ <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\RuntimeHelpers.cs" /> <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\TypeDependencyAttribute.cs" /> <Compile Include="$(BclSourcesRoot)\System\Runtime\GcSettings.cs" /> - <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\COMException.cs" /> <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\ComTypes\IEnumerable.cs" /> <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\CriticalHandle.CoreCLR.cs" /> <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\Expando\IExpando.cs" /> 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 df9a17e730..45e8cbc273 100644 --- a/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems +++ b/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems @@ -580,6 +580,7 @@ <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\BStrWrapper.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\BestFitMappingAttribute.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\CallingConvention.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\COMException.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\CharSet.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\ClassInterfaceAttribute.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\ClassInterfaceType.cs" /> diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/COMException.cs b/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/COMException.cs index f1ddf65888..0823c5670c 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/COMException.cs +++ b/src/System.Private.CoreLib/shared/System/Runtime/InteropServices/COMException.cs @@ -2,9 +2,9 @@ // 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.CompilerServices; using System.Runtime.Serialization; using System.Globalization; +using System.Text; namespace System.Runtime.InteropServices { @@ -14,7 +14,7 @@ namespace System.Runtime.InteropServices /// recognize the HResult. /// </summary> [Serializable] - [TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class COMException : ExternalException { public COMException() @@ -47,28 +47,28 @@ namespace System.Runtime.InteropServices public override string ToString() { - string message = Message; - string s; - string _className = GetType().ToString(); - s = _className + " (0x" + HResult.ToString("X8", CultureInfo.InvariantCulture) + ")"; + StringBuilder s = new StringBuilder(); + + string className = GetType().ToString(); + s.Append(className).Append(" (0x").Append(HResult.ToString("X8", CultureInfo.InvariantCulture)).Append(')'); - if (!(message == null || message.Length <= 0)) + string message = Message; + if (!string.IsNullOrEmpty(message)) { - s = s + ": " + message; + s.Append(": ").Append(message); } - Exception _innerException = InnerException; - - if (_innerException != null) + Exception innerException = InnerException; + if (innerException != null) { - s = s + " ---> " + _innerException.ToString(); + s.Append(" ---> ").Append(innerException.ToString()); } + string stackTrace = StackTrace; + if (stackTrace != null) + s.Append(Environment.NewLine).Append(stackTrace); - if (StackTrace != null) - s += Environment.NewLine + StackTrace; - - return s; + return s.ToString(); } } } |