diff options
author | Jiyoung Yun <jy910.yun@samsung.com> | 2017-04-13 14:17:19 +0900 |
---|---|---|
committer | Jiyoung Yun <jy910.yun@samsung.com> | 2017-04-13 14:17:19 +0900 |
commit | a56e30c8d33048216567753d9d3fefc2152af8ac (patch) | |
tree | 7e5d979695fc4a431740982eb1cfecc2898b23a5 /src/mscorlib/src/System/Runtime/InteropServices/COMException.cs | |
parent | 4b11dc566a5bbfa1378d6266525c281b028abcc8 (diff) | |
download | coreclr-a56e30c8d33048216567753d9d3fefc2152af8ac.tar.gz coreclr-a56e30c8d33048216567753d9d3fefc2152af8ac.tar.bz2 coreclr-a56e30c8d33048216567753d9d3fefc2152af8ac.zip |
Imported Upstream version 2.0.0.11353upstream/2.0.0.11353
Diffstat (limited to 'src/mscorlib/src/System/Runtime/InteropServices/COMException.cs')
-rw-r--r-- | src/mscorlib/src/System/Runtime/InteropServices/COMException.cs | 60 |
1 files changed, 33 insertions, 27 deletions
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/COMException.cs b/src/mscorlib/src/System/Runtime/InteropServices/COMException.cs index 87e6be6d4e..889a74f6bc 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/COMException.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/COMException.cs @@ -12,55 +12,63 @@ ** =============================================================================*/ -namespace System.Runtime.InteropServices { - using System; - using System.Runtime.Serialization; - using System.Globalization; - using System.Security; - using Microsoft.Win32; +using System; +using System.Runtime.Serialization; +using System.Globalization; +using System.Security; +using Microsoft.Win32; +namespace System.Runtime.InteropServices +{ // Exception for COM Interop errors where we don't recognize the HResult. // [Serializable] - public class COMException : ExternalException { - public COMException() - : base(Environment.GetResourceString("Arg_COMException")) + public class COMException : ExternalException + { + public COMException() + : base(SR.Arg_COMException) { - SetErrorCode(__HResults.E_FAIL); + HResult = __HResults.E_FAIL; } - - public COMException(String message) + + public COMException(String message) : base(message) { - SetErrorCode(__HResults.E_FAIL); + HResult = __HResults.E_FAIL; } - - public COMException(String message, Exception inner) - : base(message, inner) { - SetErrorCode(__HResults.E_FAIL); + + public COMException(String message, Exception inner) + : base(message, inner) + { + HResult = __HResults.E_FAIL; } - - public COMException(String message,int errorCode) - : base(message) { - SetErrorCode(errorCode); + + public COMException(String message, int errorCode) + : base(message) + { + HResult = errorCode; } - protected COMException(SerializationInfo info, StreamingContext context) : base(info, context) { + protected COMException(SerializationInfo info, StreamingContext context) : base(info, context) + { } - public override String ToString() { + public override String ToString() + { String message = Message; String s; String _className = GetType().ToString(); s = _className + " (0x" + HResult.ToString("X8", CultureInfo.InvariantCulture) + ")"; - if (!(message == null || message.Length <= 0)) { + if (!(message == null || message.Length <= 0)) + { s = s + ": " + message; } Exception _innerException = InnerException; - if (_innerException!=null) { + if (_innerException != null) + { s = s + " ---> " + _innerException.ToString(); } @@ -70,7 +78,5 @@ namespace System.Runtime.InteropServices { return s; } - - } } |