Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Runtime / InteropServices / COMException.cs / 1305376 / COMException.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================================== ** ** Class: COMException ** ** ** Purpose: Exception class for all errors from COM Interop where we don't ** recognize the HResult. ** ** =============================================================================*/ namespace System.Runtime.InteropServices { using System.Runtime.InteropServices; using System; using System.Runtime.Serialization; using System.Globalization; // Exception for COM Interop errors where we don't recognize the HResult. // [System.Runtime.InteropServices.ComVisible(true)] [Serializable] public class COMException : ExternalException { public COMException() : base(Environment.GetResourceString("Arg_COMException")) { SetErrorCode(__HResults.E_FAIL); } public COMException(String message) : base(message) { SetErrorCode(__HResults.E_FAIL); } public COMException(String message, Exception inner) : base(message, inner) { SetErrorCode(__HResults.E_FAIL); } public COMException(String message,int errorCode) : base(message) { SetErrorCode(errorCode); } [System.Security.SecuritySafeCritical] // auto-generated protected COMException(SerializationInfo info, StreamingContext context) : base(info, context) { } [System.Security.SecuritySafeCritical] // auto-generated 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)) { s = s + ": " + message; } Exception _innerException = InnerException; if (_innerException!=null) { s = s + " ---> " + _innerException.ToString(); } if (StackTrace != null) s += Environment.NewLine + StackTrace; return s; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================================== ** ** Class: COMException ** ** ** Purpose: Exception class for all errors from COM Interop where we don't ** recognize the HResult. ** ** =============================================================================*/ namespace System.Runtime.InteropServices { using System.Runtime.InteropServices; using System; using System.Runtime.Serialization; using System.Globalization; // Exception for COM Interop errors where we don't recognize the HResult. // [System.Runtime.InteropServices.ComVisible(true)] [Serializable] public class COMException : ExternalException { public COMException() : base(Environment.GetResourceString("Arg_COMException")) { SetErrorCode(__HResults.E_FAIL); } public COMException(String message) : base(message) { SetErrorCode(__HResults.E_FAIL); } public COMException(String message, Exception inner) : base(message, inner) { SetErrorCode(__HResults.E_FAIL); } public COMException(String message,int errorCode) : base(message) { SetErrorCode(errorCode); } [System.Security.SecuritySafeCritical] // auto-generated protected COMException(SerializationInfo info, StreamingContext context) : base(info, context) { } [System.Security.SecuritySafeCritical] // auto-generated 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)) { s = s + ": " + message; } Exception _innerException = InnerException; if (_innerException!=null) { s = s + " ---> " + _innerException.ToString(); } if (StackTrace != null) s += Environment.NewLine + StackTrace; return s; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- JapaneseLunisolarCalendar.cs
- DetailsViewCommandEventArgs.cs
- OdbcTransaction.cs
- RunClient.cs
- Int32CAMarshaler.cs
- PointLight.cs
- RecommendedAsConfigurableAttribute.cs
- SuppressIldasmAttribute.cs
- SqlError.cs
- FormattedTextSymbols.cs
- ListViewGroupItemCollection.cs
- RadioButtonAutomationPeer.cs
- JsonReaderWriterFactory.cs
- PanelDesigner.cs
- ColorTransformHelper.cs
- PrimitiveOperationFormatter.cs
- OutputCacheSettings.cs
- LessThan.cs
- Knowncolors.cs
- FileStream.cs
- EntityException.cs
- Keywords.cs
- GcSettings.cs
- ValueSerializerAttribute.cs
- ElementNotEnabledException.cs
- PerfProviderCollection.cs
- OperationContractAttribute.cs
- InternalBase.cs
- XmlElementAttribute.cs
- RtfControls.cs
- Attributes.cs
- X509LogoTypeExtension.cs
- LocatorBase.cs
- ColorKeyFrameCollection.cs
- ThreadInterruptedException.cs
- TabletCollection.cs
- AuthenticationConfig.cs
- ComponentCollection.cs
- UserUseLicenseDictionaryLoader.cs
- FixedBufferAttribute.cs
- XmlChildNodes.cs
- Compress.cs
- ObjectDataSourceStatusEventArgs.cs
- SqlXmlStorage.cs
- RemotingAttributes.cs
- DesignerActionTextItem.cs
- ExceptionValidationRule.cs
- TextReader.cs
- GenerateScriptTypeAttribute.cs
- AmbientValueAttribute.cs
- followingquery.cs
- Pointer.cs
- WebExceptionStatus.cs
- VisualBrush.cs
- ControlParameter.cs
- BitmapScalingModeValidation.cs
- XPathDocumentNavigator.cs
- SaveWorkflowAsyncResult.cs
- RegexCompilationInfo.cs
- KeyInstance.cs
- FormsAuthenticationUser.cs
- MasterPage.cs
- DbConnectionInternal.cs
- MinMaxParagraphWidth.cs
- HttpMethodAttribute.cs
- CrossContextChannel.cs
- SqlFunctions.cs
- MessageRpc.cs
- HtmlTableRowCollection.cs
- PerformanceCounterNameAttribute.cs
- MenuScrollingVisibilityConverter.cs
- PassportIdentity.cs
- AsnEncodedData.cs
- TdsParser.cs
- ConnectionProviderAttribute.cs
- Keywords.cs
- PropertyTabAttribute.cs
- RSAPKCS1SignatureDeformatter.cs
- GraphicsContext.cs
- PackageFilter.cs
- HwndSourceKeyboardInputSite.cs
- GcSettings.cs
- ConnectionPoint.cs
- _TLSstream.cs
- Transform3D.cs
- ZipFileInfoCollection.cs
- WeakReferenceKey.cs
- TemplateParser.cs
- ToolboxItemFilterAttribute.cs
- AssociationSet.cs
- ObjectDataProvider.cs
- SessionStateSection.cs
- WebPartConnectionsDisconnectVerb.cs
- SlipBehavior.cs
- ChangeTracker.cs
- PropertyGeneratedEventArgs.cs
- DataControlFieldsEditor.cs
- ConfigurationManagerHelper.cs
- LoginCancelEventArgs.cs