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
- ZipPackagePart.cs
- HtmlControlPersistable.cs
- HtmlElementErrorEventArgs.cs
- LogicalTreeHelper.cs
- TranslateTransform.cs
- X509WindowsSecurityToken.cs
- DependencySource.cs
- _IPv6Address.cs
- DrawListViewSubItemEventArgs.cs
- cookieexception.cs
- LinkedResourceCollection.cs
- PackageRelationshipCollection.cs
- SafeIUnknown.cs
- PersonalizationEntry.cs
- RijndaelManaged.cs
- PropertyGroupDescription.cs
- WebHostScriptMappingsInstallComponent.cs
- RequiredAttributeAttribute.cs
- TypeDescriptor.cs
- UxThemeWrapper.cs
- GenericAuthenticationEventArgs.cs
- ResourceAttributes.cs
- DebugView.cs
- ExtractedStateEntry.cs
- XslNumber.cs
- XmlUtil.cs
- AsnEncodedData.cs
- XPathAncestorQuery.cs
- DomainConstraint.cs
- ListenerElementsCollection.cs
- ElementUtil.cs
- IndexerHelper.cs
- M3DUtil.cs
- Drawing.cs
- InlineObject.cs
- IgnoreSection.cs
- PropertyPathWorker.cs
- SqlNode.cs
- TextEditorParagraphs.cs
- PropertyMapper.cs
- SystemWebCachingSectionGroup.cs
- WebPartPersonalization.cs
- ExceptionUtility.cs
- StringConcat.cs
- ConnectionManagementSection.cs
- ConfigurationConverterBase.cs
- SoapTypeAttribute.cs
- EntityExpressionVisitor.cs
- SevenBitStream.cs
- SystemUdpStatistics.cs
- bidPrivateBase.cs
- MetadataItemEmitter.cs
- RowToFieldTransformer.cs
- SponsorHelper.cs
- ITreeGenerator.cs
- MsdtcClusterUtils.cs
- ConfigXmlWhitespace.cs
- _LoggingObject.cs
- EntityKeyElement.cs
- DocumentNUp.cs
- XamlFigureLengthSerializer.cs
- AsyncInvokeContext.cs
- DataControlLinkButton.cs
- OpenFileDialog.cs
- Rules.cs
- DictionaryItemsCollection.cs
- WebPartsPersonalization.cs
- PerformanceCountersElement.cs
- Transform3D.cs
- WebPartsPersonalizationAuthorization.cs
- MailWebEventProvider.cs
- ConvertersCollection.cs
- RectangleHotSpot.cs
- DataControlFieldCollection.cs
- TileBrush.cs
- XPathSelectionIterator.cs
- MasterPageParser.cs
- QuotedPrintableStream.cs
- Attachment.cs
- ComplexLine.cs
- ToolStripLabel.cs
- MexTcpBindingElement.cs
- ZipIOExtraFieldElement.cs
- HandleCollector.cs
- OutputBuffer.cs
- securestring.cs
- DataViewListener.cs
- XPathSelectionIterator.cs
- SelectionItemProviderWrapper.cs
- TreeView.cs
- GenerateScriptTypeAttribute.cs
- TPLETWProvider.cs
- AssociationTypeEmitter.cs
- HorizontalAlignConverter.cs
- CommandLineParser.cs
- PersonalizationProviderHelper.cs
- ScalarType.cs
- DataGridViewSelectedRowCollection.cs
- PackageDigitalSignatureManager.cs
- ReachDocumentReferenceSerializer.cs