Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ExpandCollapsePattern.cs
- Label.cs
- CheckBoxAutomationPeer.cs
- DocumentEventArgs.cs
- RenderingEventArgs.cs
- SoapObjectInfo.cs
- MDIControlStrip.cs
- TransformValueSerializer.cs
- XmlTextAttribute.cs
- HttpResponse.cs
- BooleanConverter.cs
- ParserOptions.cs
- XmlElementAttribute.cs
- PlainXmlWriter.cs
- _ListenerRequestStream.cs
- JobCollate.cs
- TableRow.cs
- CssStyleCollection.cs
- CodeIdentifiers.cs
- ImageMapEventArgs.cs
- MDIControlStrip.cs
- ServiceNameElementCollection.cs
- parserscommon.cs
- BitmapSizeOptions.cs
- ReachSerializationCacheItems.cs
- ThreadPool.cs
- ManualResetEvent.cs
- EditorPartChrome.cs
- XmlNamedNodeMap.cs
- MimeXmlImporter.cs
- Column.cs
- WebPartRestoreVerb.cs
- AuthenticationConfig.cs
- GlyphInfoList.cs
- QuadraticBezierSegment.cs
- ExpressionBindingsDialog.cs
- TextWriter.cs
- WCFServiceClientProxyGenerator.cs
- ListControl.cs
- RedistVersionInfo.cs
- WindowsTitleBar.cs
- HttpModuleActionCollection.cs
- RowType.cs
- SqlComparer.cs
- WinInet.cs
- SafeHandles.cs
- DynamicRouteExpression.cs
- XmlnsDefinitionAttribute.cs
- CheckBoxField.cs
- XmlSchemaNotation.cs
- TimeSpanValidatorAttribute.cs
- arabicshape.cs
- PropertyMetadata.cs
- Triplet.cs
- TrailingSpaceComparer.cs
- OleDbConnectionFactory.cs
- XmlSchemaAppInfo.cs
- XmlCDATASection.cs
- Enum.cs
- MergeExecutor.cs
- StructuredProperty.cs
- ToolStripPanelRenderEventArgs.cs
- SplitterEvent.cs
- TemplatedMailWebEventProvider.cs
- DesignSurface.cs
- ProviderSettings.cs
- AuthenticationService.cs
- ToolBarDesigner.cs
- Operator.cs
- IconBitmapDecoder.cs
- SoapEnumAttribute.cs
- OdbcConnectionOpen.cs
- DownloadProgressEventArgs.cs
- CompModHelpers.cs
- TableCellAutomationPeer.cs
- RIPEMD160Managed.cs
- CacheOutputQuery.cs
- HelpKeywordAttribute.cs
- PersonalizationStateQuery.cs
- DataMemberFieldConverter.cs
- RuntimeConfigurationRecord.cs
- CultureTable.cs
- CompareInfo.cs
- Track.cs
- XPathNavigatorReader.cs
- BamlLocalizer.cs
- VisualStyleElement.cs
- PartialArray.cs
- DefaultBindingPropertyAttribute.cs
- XmlHierarchicalDataSourceView.cs
- EntityPropertyMappingAttribute.cs
- HtmlTextArea.cs
- Types.cs
- Configuration.cs
- LocalizableResourceBuilder.cs
- EncoderParameter.cs
- CacheAxisQuery.cs
- RightsManagementPermission.cs
- ParseHttpDate.cs
- DataGridColumn.cs