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
- SqlBuilder.cs
- WsdlInspector.cs
- TextRangeEdit.cs
- NameSpaceEvent.cs
- ListViewItemEventArgs.cs
- XPathSelfQuery.cs
- SafeLocalAllocation.cs
- thaishape.cs
- MetadataArtifactLoaderFile.cs
- DataServiceBehavior.cs
- DrawingBrush.cs
- NumberSubstitution.cs
- TextRangeEdit.cs
- MetricEntry.cs
- DataProtection.cs
- ACE.cs
- DbException.cs
- ToolStripPanelCell.cs
- GeneralTransform3DCollection.cs
- XamlReaderHelper.cs
- XmlDocumentFragment.cs
- PublisherMembershipCondition.cs
- RequestResponse.cs
- NonParentingControl.cs
- HotCommands.cs
- TextUtf8RawTextWriter.cs
- ThousandthOfEmRealPoints.cs
- XsltSettings.cs
- DocumentPage.cs
- SslStreamSecurityBindingElement.cs
- coordinator.cs
- XmlIncludeAttribute.cs
- AdornerHitTestResult.cs
- CodeAttributeArgument.cs
- InternalConfigConfigurationFactory.cs
- ZipFileInfo.cs
- SessionStateItemCollection.cs
- WebMessageEncoderFactory.cs
- AttachedProperty.cs
- FilteredReadOnlyMetadataCollection.cs
- DocumentXmlWriter.cs
- XmlNamedNodeMap.cs
- SqlConnectionPoolProviderInfo.cs
- AlphaSortedEnumConverter.cs
- ProviderUtil.cs
- ColorIndependentAnimationStorage.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- VerificationException.cs
- FontNamesConverter.cs
- ScrollEvent.cs
- SystemGatewayIPAddressInformation.cs
- DiagnosticTrace.cs
- ErrorInfoXmlDocument.cs
- LineMetrics.cs
- QuotedStringWriteStateInfo.cs
- IriParsingElement.cs
- ElementFactory.cs
- Range.cs
- XmlArrayAttribute.cs
- RadioButton.cs
- NullableDoubleMinMaxAggregationOperator.cs
- CustomValidator.cs
- WebPartZoneCollection.cs
- DataSourceControlBuilder.cs
- HtmlElement.cs
- AlignmentXValidation.cs
- IISMapPath.cs
- ToolStripRenderer.cs
- OLEDB_Util.cs
- FrameworkElement.cs
- ComponentRenameEvent.cs
- TemplateBindingExpression.cs
- SynchronizedDispatch.cs
- PopupRootAutomationPeer.cs
- SynchronizationLockException.cs
- WebSysDisplayNameAttribute.cs
- DataControlExtensions.cs
- TypeToken.cs
- HttpRequestCacheValidator.cs
- HwndSourceParameters.cs
- ClientApiGenerator.cs
- NameNode.cs
- ConfigUtil.cs
- NavigationWindow.cs
- CharKeyFrameCollection.cs
- Misc.cs
- CompiledELinqQueryState.cs
- WebPartManager.cs
- DesignerAdRotatorAdapter.cs
- OpenTypeLayoutCache.cs
- StatusBarItemAutomationPeer.cs
- DbDataSourceEnumerator.cs
- MergeLocalizationDirectives.cs
- ImageFormat.cs
- PerformanceCounterLib.cs
- EntityContainerEmitter.cs
- ResourceDescriptionAttribute.cs
- FieldBuilder.cs
- MailWebEventProvider.cs
- PropertyGridView.cs