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
- JsonEnumDataContract.cs
- JsonReader.cs
- MultiPropertyDescriptorGridEntry.cs
- UrlPropertyAttribute.cs
- ColorKeyFrameCollection.cs
- VScrollProperties.cs
- EncryptedPackageFilter.cs
- MaskedTextBox.cs
- ProfilePropertySettings.cs
- PageTheme.cs
- SchemaImporterExtension.cs
- DebugHandleTracker.cs
- EventLogPermissionEntry.cs
- TreeNodeMouseHoverEvent.cs
- CategoryGridEntry.cs
- ViewCellSlot.cs
- GACMembershipCondition.cs
- RemotingSurrogateSelector.cs
- ContactManager.cs
- MailMessageEventArgs.cs
- MarkupObject.cs
- GregorianCalendar.cs
- DbProviderFactories.cs
- clipboard.cs
- XmlConvert.cs
- Cursor.cs
- SecurityTokenAttachmentMode.cs
- IsolatedStorageFilePermission.cs
- DesignerAdapterAttribute.cs
- MessageVersionConverter.cs
- CheckBoxStandardAdapter.cs
- XamlDesignerSerializationManager.cs
- ProxyHelper.cs
- LayoutTable.cs
- InfoCardTrace.cs
- PathHelper.cs
- DataRowIndexBuffer.cs
- Baml2006ReaderContext.cs
- TransformProviderWrapper.cs
- AnonymousIdentificationModule.cs
- ZipIOLocalFileHeader.cs
- NamedElement.cs
- DataGridViewCellStyleEditor.cs
- StylusPointPropertyId.cs
- SmtpException.cs
- BaseCollection.cs
- HandlerBase.cs
- Cursors.cs
- SR.cs
- DBDataPermissionAttribute.cs
- DbExpressionRules.cs
- NativeActivityMetadata.cs
- SmiMetaDataProperty.cs
- Point3DValueSerializer.cs
- SecurityTokenRequirement.cs
- DefaultDialogButtons.cs
- WriteStateInfoBase.cs
- DSGeneratorProblem.cs
- Group.cs
- TextSelectionProcessor.cs
- DbConnectionPoolGroupProviderInfo.cs
- SerializationObjectManager.cs
- ClientSection.cs
- CheckBoxFlatAdapter.cs
- HtmlTableCellCollection.cs
- _SafeNetHandles.cs
- KeyBinding.cs
- Win32Interop.cs
- DateRangeEvent.cs
- XslException.cs
- SpeechUI.cs
- HwndTarget.cs
- ClientSideProviderDescription.cs
- TextTreeUndoUnit.cs
- MembershipPasswordException.cs
- LayoutSettings.cs
- SqlBinder.cs
- UriSection.cs
- CompilationRelaxations.cs
- ConnectionAcceptor.cs
- CodeMethodReturnStatement.cs
- HandledMouseEvent.cs
- PerformanceCounterPermission.cs
- TakeQueryOptionExpression.cs
- MenuItem.cs
- SafeHandle.cs
- MainMenu.cs
- XMLSchema.cs
- DrawingState.cs
- LocalizationParserHooks.cs
- LinkClickEvent.cs
- TypeElementCollection.cs
- ServiceReference.cs
- NavigatorInput.cs
- DocumentViewerAutomationPeer.cs
- MachineKeySection.cs
- BitmapEffectInput.cs
- WebPartCollection.cs
- AnnotationHelper.cs
- TextBreakpoint.cs