Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / clr / src / BCL / System / Runtime / InteropServices / COMException.cs / 1 / 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); } protected COMException(SerializationInfo info, StreamingContext context) : base(info, context) { } 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); } protected COMException(SerializationInfo info, StreamingContext context) : base(info, context) { } 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
- XmlUrlResolver.cs
- HeaderedItemsControl.cs
- SocketElement.cs
- SslStream.cs
- XmlLoader.cs
- XPathDocumentNavigator.cs
- NumberFormatInfo.cs
- RemotingConfiguration.cs
- DBConcurrencyException.cs
- SQLBytesStorage.cs
- ToolBarTray.cs
- TreeNodeStyleCollection.cs
- PageParser.cs
- ExpandedProjectionNode.cs
- XmlCDATASection.cs
- ImageClickEventArgs.cs
- PeerEndPoint.cs
- NullableConverter.cs
- HebrewNumber.cs
- WebPartConnectVerb.cs
- RoleManagerEventArgs.cs
- EventLogger.cs
- Selection.cs
- SoapConverter.cs
- DbFunctionCommandTree.cs
- EventSinkHelperWriter.cs
- MasterPageParser.cs
- CacheRequest.cs
- SafeBitVector32.cs
- DetailsViewUpdatedEventArgs.cs
- ProfileGroupSettings.cs
- PropertyPathWorker.cs
- Object.cs
- Int32CollectionConverter.cs
- BitmapEffectrendercontext.cs
- StringUtil.cs
- MessageBox.cs
- EventListenerClientSide.cs
- QilScopedVisitor.cs
- SelectionItemPattern.cs
- ContextMenuStrip.cs
- DataGridViewRowPrePaintEventArgs.cs
- SpecularMaterial.cs
- DesignerActionService.cs
- DiagnosticTrace.cs
- ThaiBuddhistCalendar.cs
- DesignerAdapterUtil.cs
- QueryResultOp.cs
- TemplateAction.cs
- CachedBitmap.cs
- XmlDataSource.cs
- XmlDocumentType.cs
- JournalEntryStack.cs
- XmlUrlResolver.cs
- wgx_commands.cs
- OutputCacheSettingsSection.cs
- ExpressionQuoter.cs
- OSFeature.cs
- HeaderLabel.cs
- DesignerPerfEventProvider.cs
- DataGridComponentEditor.cs
- DifferencingCollection.cs
- ToolStripRendererSwitcher.cs
- WebPartsPersonalization.cs
- Metadata.cs
- BufferModeSettings.cs
- AxHost.cs
- EnumerableWrapperWeakToStrong.cs
- BrowserDefinitionCollection.cs
- DictionaryContent.cs
- ClientTarget.cs
- EmptyQuery.cs
- ToolZone.cs
- InfoCardProofToken.cs
- XmlSchemaSimpleTypeList.cs
- CodeObjectCreateExpression.cs
- MultipleViewPattern.cs
- CompiledQueryCacheKey.cs
- DocumentCollection.cs
- SqlUDTStorage.cs
- PointKeyFrameCollection.cs
- RegexCharClass.cs
- ClosableStream.cs
- PrintControllerWithStatusDialog.cs
- ActiveXHost.cs
- SchemaCollectionCompiler.cs
- odbcmetadatacolumnnames.cs
- ColumnReorderedEventArgs.cs
- MdiWindowListStrip.cs
- AQNBuilder.cs
- ConnectionPool.cs
- ZoneButton.cs
- AmbientLight.cs
- WCFModelStrings.Designer.cs
- AutomationProperties.cs
- Decimal.cs
- AppDomainProtocolHandler.cs
- SelectionEditor.cs
- SqlReferenceCollection.cs
- WindowsListViewItemStartMenu.cs