Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / MS / Internal / CriticalExceptions.cs / 1305600 / CriticalExceptions.cs
using System; #if PBTCOMPILER namespace MS.Internal.Markup #elif SYSTEM_XAML namespace System.Xaml #else using MS.Internal.WindowsBase; // FriendAccessAllowed namespace MS.Internal #endif { #if !PBTCOMPILER && !SYSTEM_XAML [FriendAccessAllowed] #endif internal static class CriticalExceptions { // these are all the exceptions considered critical by PreSharp #if !PBTCOMPILER && !SYSTEM_XAML [FriendAccessAllowed] #endif internal static bool IsCriticalException(Exception ex) { ex = Unwrap(ex); return ex is NullReferenceException || ex is StackOverflowException || ex is OutOfMemoryException || ex is System.Threading.ThreadAbortException || ex is System.Runtime.InteropServices.SEHException || ex is System.Security.SecurityException; } // these are exceptions that we should treat as critical when they // arise during callbacks into application code #if !PBTCOMPILER && !SYSTEM_XAML [FriendAccessAllowed] internal static bool IsCriticalApplicationException(Exception ex) { ex = Unwrap(ex); return ex is StackOverflowException || ex is OutOfMemoryException || ex is System.Threading.ThreadAbortException || ex is System.Security.SecurityException; } #endif #if !PBTCOMPILER && !SYSTEM_XAML [FriendAccessAllowed] #endif internal static Exception Unwrap(Exception ex) { // for certain types of exceptions, we care more about the inner // exception while (ex.InnerException != null && ( ex is System.Reflection.TargetInvocationException )) { ex = ex.InnerException; } return ex; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; #if PBTCOMPILER namespace MS.Internal.Markup #elif SYSTEM_XAML namespace System.Xaml #else using MS.Internal.WindowsBase; // FriendAccessAllowed namespace MS.Internal #endif { #if !PBTCOMPILER && !SYSTEM_XAML [FriendAccessAllowed] #endif internal static class CriticalExceptions { // these are all the exceptions considered critical by PreSharp #if !PBTCOMPILER && !SYSTEM_XAML [FriendAccessAllowed] #endif internal static bool IsCriticalException(Exception ex) { ex = Unwrap(ex); return ex is NullReferenceException || ex is StackOverflowException || ex is OutOfMemoryException || ex is System.Threading.ThreadAbortException || ex is System.Runtime.InteropServices.SEHException || ex is System.Security.SecurityException; } // these are exceptions that we should treat as critical when they // arise during callbacks into application code #if !PBTCOMPILER && !SYSTEM_XAML [FriendAccessAllowed] internal static bool IsCriticalApplicationException(Exception ex) { ex = Unwrap(ex); return ex is StackOverflowException || ex is OutOfMemoryException || ex is System.Threading.ThreadAbortException || ex is System.Security.SecurityException; } #endif #if !PBTCOMPILER && !SYSTEM_XAML [FriendAccessAllowed] #endif internal static Exception Unwrap(Exception ex) { // for certain types of exceptions, we care more about the inner // exception while (ex.InnerException != null && ( ex is System.Reflection.TargetInvocationException )) { ex = ex.InnerException; } return ex; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlCharType.cs
- ToolStripLabel.cs
- ProcessHostFactoryHelper.cs
- ArrayList.cs
- coordinatorscratchpad.cs
- SchemaNamespaceManager.cs
- NavigationProgressEventArgs.cs
- CSharpCodeProvider.cs
- ThrowOnMultipleAssignment.cs
- ToolStripComboBox.cs
- ExpressionPrinter.cs
- ContainerParaClient.cs
- ActionItem.cs
- ExtensionDataReader.cs
- LogLogRecord.cs
- PersonalizableTypeEntry.cs
- ButtonFieldBase.cs
- GridItemPatternIdentifiers.cs
- DefaultIfEmptyQueryOperator.cs
- EastAsianLunisolarCalendar.cs
- RangeValuePatternIdentifiers.cs
- ConfigPathUtility.cs
- ExtensionQuery.cs
- SpecialNameAttribute.cs
- SecurityContext.cs
- UnsafeNetInfoNativeMethods.cs
- ErrorStyle.cs
- AppDomainGrammarProxy.cs
- ScopeElementCollection.cs
- DeclaredTypeValidatorAttribute.cs
- ListViewDeletedEventArgs.cs
- Empty.cs
- HitTestDrawingContextWalker.cs
- SemaphoreSecurity.cs
- DataMember.cs
- DropSource.cs
- SingleKeyFrameCollection.cs
- _WinHttpWebProxyDataBuilder.cs
- localization.cs
- HttpDictionary.cs
- altserialization.cs
- KeyValueInternalCollection.cs
- DataGridViewCellStyleConverter.cs
- SerializationInfoEnumerator.cs
- System.Data.OracleClient_BID.cs
- ToolStripOverflow.cs
- UnknownWrapper.cs
- TableLayoutStyle.cs
- TemplateContent.cs
- CryptoApi.cs
- ReadOnlyCollection.cs
- OpenFileDialog.cs
- DropShadowBitmapEffect.cs
- PersonalizationDictionary.cs
- FastPropertyAccessor.cs
- DrawingBrush.cs
- TitleStyle.cs
- Panel.cs
- Timer.cs
- Attributes.cs
- WeakReadOnlyCollection.cs
- BoolExpression.cs
- XPathSingletonIterator.cs
- HtmlInputFile.cs
- AnonymousIdentificationSection.cs
- SiteMapPathDesigner.cs
- AnnotationResourceChangedEventArgs.cs
- MailSettingsSection.cs
- TemplateControl.cs
- XNameConverter.cs
- ConfigurationManagerHelper.cs
- HierarchicalDataSourceControl.cs
- ResourceReferenceKeyNotFoundException.cs
- SolidBrush.cs
- EntityModelSchemaGenerator.cs
- XmlReturnWriter.cs
- HwndTarget.cs
- ProvidePropertyAttribute.cs
- MetadataItemEmitter.cs
- OracleRowUpdatingEventArgs.cs
- LexicalChunk.cs
- SuppressMessageAttribute.cs
- OletxVolatileEnlistment.cs
- ObjectReaderCompiler.cs
- MobileCategoryAttribute.cs
- Int32RectValueSerializer.cs
- ListParaClient.cs
- StylusDownEventArgs.cs
- XmlDeclaration.cs
- EmptyStringExpandableObjectConverter.cs
- XmlTextReaderImpl.cs
- MailMessageEventArgs.cs
- documentsequencetextpointer.cs
- OdbcError.cs
- DataGridViewAutoSizeModeEventArgs.cs
- ListControl.cs
- EventMap.cs
- OutputCacheSection.cs
- ConfigurationElementProperty.cs
- GeneralTransformGroup.cs