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
- SrgsNameValueTag.cs
- NextPreviousPagerField.cs
- InstanceCompleteException.cs
- DataColumn.cs
- BindingBase.cs
- SecurityRuntime.cs
- SafeSerializationManager.cs
- MobileRedirect.cs
- GrammarBuilderWildcard.cs
- ClassicBorderDecorator.cs
- DNS.cs
- SrgsSubset.cs
- OleDbConnectionFactory.cs
- PropertyGeneratedEventArgs.cs
- XpsS0ValidatingLoader.cs
- dataobject.cs
- ObjectStateEntry.cs
- WebAdminConfigurationHelper.cs
- ValidateNames.cs
- QueryCreatedEventArgs.cs
- RegistryPermission.cs
- RegexMatch.cs
- InstallerTypeAttribute.cs
- RuleCache.cs
- DefaultMergeHelper.cs
- ContextMenuStripGroup.cs
- ConsoleTraceListener.cs
- DrawingState.cs
- CustomExpressionEventArgs.cs
- CompModSwitches.cs
- WmiInstallComponent.cs
- VideoDrawing.cs
- PrefixQName.cs
- RenderingEventArgs.cs
- ResourcePart.cs
- SmtpNtlmAuthenticationModule.cs
- ClientScriptManagerWrapper.cs
- XmlCharCheckingWriter.cs
- FormParameter.cs
- SmtpFailedRecipientsException.cs
- WizardSideBarListControlItem.cs
- CurrencyWrapper.cs
- DispatcherHooks.cs
- Localizer.cs
- ButtonAutomationPeer.cs
- HotSpot.cs
- PagedDataSource.cs
- SystemThemeKey.cs
- TypeConverter.cs
- ServiceReference.cs
- GreenMethods.cs
- GeneratedContractType.cs
- SecurityKeyIdentifier.cs
- DataGridColumn.cs
- Sequence.cs
- PixelFormats.cs
- GPStream.cs
- ResourceCategoryAttribute.cs
- MetadataCache.cs
- UserControl.cs
- PersonalizablePropertyEntry.cs
- DBSqlParserTableCollection.cs
- SystemTcpConnection.cs
- DomNameTable.cs
- MarkupCompilePass1.cs
- WindowsFormsSectionHandler.cs
- EUCJPEncoding.cs
- CompileXomlTask.cs
- HeaderedItemsControl.cs
- RelationshipConstraintValidator.cs
- PeerTransportSecuritySettings.cs
- WebPartEditorApplyVerb.cs
- AnonymousIdentificationModule.cs
- MissingManifestResourceException.cs
- TextPenaltyModule.cs
- RelationshipWrapper.cs
- ExecutionContext.cs
- RadioButtonStandardAdapter.cs
- WorkItem.cs
- JsonServiceDocumentSerializer.cs
- RegexCompiler.cs
- ExpressionTextBox.xaml.cs
- ComponentCollection.cs
- KeyPressEvent.cs
- Relationship.cs
- MulticastDelegate.cs
- HtmlProps.cs
- TraceShell.cs
- PreviewPrintController.cs
- Repeater.cs
- TypeInformation.cs
- SourceChangedEventArgs.cs
- HtmlInputSubmit.cs
- RemoteWebConfigurationHostStream.cs
- PtsCache.cs
- PassportAuthentication.cs
- AdditionalEntityFunctions.cs
- FormatSettings.cs
- TypeDescriptionProviderAttribute.cs
- XmlSerializerAssemblyAttribute.cs