summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Runtime/InteropServices/COMException.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/Runtime/InteropServices/COMException.cs')
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/COMException.cs60
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;
}
-
-
}
}