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
- SqlDataReader.cs
- HttpConfigurationContext.cs
- __TransparentProxy.cs
- HierarchicalDataBoundControlAdapter.cs
- Metadata.cs
- CallContext.cs
- TreeViewCancelEvent.cs
- GetIsBrowserClientRequest.cs
- FixedSOMSemanticBox.cs
- BaseServiceProvider.cs
- _ContextAwareResult.cs
- CharacterBuffer.cs
- EncoderReplacementFallback.cs
- _LocalDataStoreMgr.cs
- HttpRequestCacheValidator.cs
- TaskDesigner.cs
- SqlCacheDependency.cs
- ApplicationException.cs
- HitTestParameters3D.cs
- RegexCompiler.cs
- Formatter.cs
- ServiceHostingEnvironment.cs
- GraphicsContext.cs
- Buffer.cs
- RelatedCurrencyManager.cs
- CmsInterop.cs
- MDIWindowDialog.cs
- AutomationPatternInfo.cs
- ByteAnimation.cs
- DesignerValidationSummaryAdapter.cs
- Catch.cs
- DateTime.cs
- StorageSetMapping.cs
- ProcessProtocolHandler.cs
- RSAPKCS1SignatureFormatter.cs
- RequestContextBase.cs
- KeyEvent.cs
- ConnectionManagementSection.cs
- StorageAssociationSetMapping.cs
- CollaborationHelperFunctions.cs
- HttpStreamMessage.cs
- AdRotator.cs
- ObjectViewQueryResultData.cs
- RedirectionProxy.cs
- NeutralResourcesLanguageAttribute.cs
- AuthenticationModulesSection.cs
- FloaterParaClient.cs
- XmlArrayItemAttribute.cs
- PackagingUtilities.cs
- SqlDependencyUtils.cs
- TrustManager.cs
- AVElementHelper.cs
- XmlImplementation.cs
- CodeGenHelper.cs
- CompiledRegexRunnerFactory.cs
- XmlRootAttribute.cs
- SmtpAuthenticationManager.cs
- storepermissionattribute.cs
- DefaultMemberAttribute.cs
- XamlTreeBuilderBamlRecordWriter.cs
- ProtectedConfiguration.cs
- VectorCollectionConverter.cs
- GestureRecognitionResult.cs
- ArgIterator.cs
- SafeNativeMemoryHandle.cs
- PropertyGridView.cs
- RefreshEventArgs.cs
- TreeIterators.cs
- NamespaceDecl.cs
- DBConcurrencyException.cs
- ControlValuePropertyAttribute.cs
- Control.cs
- SoapDocumentServiceAttribute.cs
- MemberAccessException.cs
- mda.cs
- SecurityElement.cs
- Triangle.cs
- XComponentModel.cs
- PointHitTestResult.cs
- ScriptResourceAttribute.cs
- KeyFrames.cs
- CustomErrorsSection.cs
- AdPostCacheSubstitution.cs
- CustomLineCap.cs
- AbandonedMutexException.cs
- PointHitTestParameters.cs
- TextWriterTraceListener.cs
- SchemaEntity.cs
- LogEntrySerializer.cs
- EntityModelSchemaGenerator.cs
- AppendHelper.cs
- StringSorter.cs
- VirtualDirectoryMapping.cs
- UseAttributeSetsAction.cs
- RuntimeConfigurationRecord.cs
- XmlBindingWorker.cs
- ToolStripManager.cs
- DbConnectionHelper.cs
- SqlWebEventProvider.cs
- QueryContinueDragEventArgs.cs