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
- InputQueueChannelAcceptor.cs
- Number.cs
- ReflectionPermission.cs
- SystemException.cs
- DefaultClaimSet.cs
- TextBoxAutoCompleteSourceConverter.cs
- MailMessage.cs
- DesignerVerbToolStripMenuItem.cs
- DelegateBodyWriter.cs
- MessageDesigner.cs
- PerformanceCounterCategory.cs
- StrongNameSignatureInformation.cs
- XmlSerializationGeneratedCode.cs
- ApplicationProxyInternal.cs
- MessageQueuePermissionEntry.cs
- EnumConverter.cs
- WebChannelFactory.cs
- ScriptModule.cs
- CompilerCollection.cs
- FragmentQueryProcessor.cs
- EntityDataSourceMemberPath.cs
- ReferenceEqualityComparer.cs
- HttpCacheVaryByContentEncodings.cs
- ClrPerspective.cs
- ToolTip.cs
- ManagedIStream.cs
- ListBoxItem.cs
- ComponentChangingEvent.cs
- SevenBitStream.cs
- DiscoveryServerProtocol.cs
- TextReader.cs
- IDictionary.cs
- RegexParser.cs
- ColorAnimation.cs
- HandlerFactoryCache.cs
- DBCommandBuilder.cs
- ScrollChangedEventArgs.cs
- Types.cs
- Error.cs
- InkCanvasSelectionAdorner.cs
- XmlDocumentType.cs
- NativeMethodsCLR.cs
- Attributes.cs
- WebBaseEventKeyComparer.cs
- ObjectItemCachedAssemblyLoader.cs
- bidPrivateBase.cs
- OutputScopeManager.cs
- _LoggingObject.cs
- Image.cs
- TemplateKeyConverter.cs
- CustomPopupPlacement.cs
- CompletedAsyncResult.cs
- BadImageFormatException.cs
- sqlnorm.cs
- InputLanguageProfileNotifySink.cs
- IdentifierCollection.cs
- CodeValidator.cs
- MessageDecoder.cs
- StorageScalarPropertyMapping.cs
- Page.cs
- ExceptionHandlersDesigner.cs
- EntityDataSourceValidationException.cs
- NavigationFailedEventArgs.cs
- EventPropertyMap.cs
- RC2CryptoServiceProvider.cs
- Scene3D.cs
- Floater.cs
- BaseResourcesBuildProvider.cs
- ReturnEventArgs.cs
- SmtpTransport.cs
- SystemEvents.cs
- ActionMessageFilterTable.cs
- SqlDataSourceTableQuery.cs
- TimerElapsedEvenArgs.cs
- PenThread.cs
- ToolStripContainerActionList.cs
- DataList.cs
- TextEditorSelection.cs
- ExceptionCollection.cs
- FrameworkElementFactoryMarkupObject.cs
- FusionWrap.cs
- DragEventArgs.cs
- Margins.cs
- LocatorPartList.cs
- RemoteWebConfigurationHostStream.cs
- VirtualPath.cs
- TransactedReceiveData.cs
- FunctionImportElement.cs
- DictionaryManager.cs
- TrackingDataItem.cs
- DrawTreeNodeEventArgs.cs
- MarshalDirectiveException.cs
- PropertyEmitterBase.cs
- Bitmap.cs
- RangeValuePatternIdentifiers.cs
- LayoutTableCell.cs
- ToggleButtonAutomationPeer.cs
- StdRegProviderWrapper.cs
- InvokeMethodActivityDesigner.cs
- UiaCoreApi.cs