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
- SqlAliaser.cs
- NameValueSectionHandler.cs
- AsyncResult.cs
- TcpTransportSecurity.cs
- CrossAppDomainChannel.cs
- GeneralTransform3DTo2DTo3D.cs
- DataGridViewRowEventArgs.cs
- Thickness.cs
- AssemblyCache.cs
- BehaviorEditorPart.cs
- KeyTimeConverter.cs
- PrinterUnitConvert.cs
- SettingsSavedEventArgs.cs
- SessionParameter.cs
- SqlUDTStorage.cs
- GroupBox.cs
- PartDesigner.cs
- NativeMethods.cs
- MatrixUtil.cs
- XPathItem.cs
- StringFormat.cs
- CodeExporter.cs
- DrawingBrush.cs
- MsdtcWrapper.cs
- HandleCollector.cs
- TargetConverter.cs
- PrimitiveSchema.cs
- StrongNameKeyPair.cs
- Object.cs
- FullTextState.cs
- HttpAsyncResult.cs
- ClientData.cs
- VectorKeyFrameCollection.cs
- Win32KeyboardDevice.cs
- DataObjectCopyingEventArgs.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- RemotingHelper.cs
- ProxyDataContractResolver.cs
- CookieParameter.cs
- followingsibling.cs
- ObjectMaterializedEventArgs.cs
- CreateParams.cs
- GradientBrush.cs
- InputManager.cs
- Int32RectConverter.cs
- DataAdapter.cs
- NavigationPropertySingletonExpression.cs
- DataGridViewSelectedCellCollection.cs
- StyleTypedPropertyAttribute.cs
- List.cs
- SchemaReference.cs
- CompoundFileIOPermission.cs
- TextDecorationCollection.cs
- StsCommunicationException.cs
- CmsInterop.cs
- Label.cs
- GenericPrincipal.cs
- FormsAuthentication.cs
- ToolboxComponentsCreatingEventArgs.cs
- GACMembershipCondition.cs
- AttributeUsageAttribute.cs
- DictionaryEntry.cs
- DiscoveryReferences.cs
- ImportedNamespaceContextItem.cs
- AccessDataSourceView.cs
- GridItemProviderWrapper.cs
- DesignTimeDataBinding.cs
- Journaling.cs
- _ScatterGatherBuffers.cs
- MeasurementDCInfo.cs
- EventToken.cs
- MetaChildrenColumn.cs
- Animatable.cs
- AccessorTable.cs
- ThreadNeutralSemaphore.cs
- CodeGenerator.cs
- CodeStatementCollection.cs
- AuditLog.cs
- EdmScalarPropertyAttribute.cs
- BrushMappingModeValidation.cs
- AuthenticationException.cs
- NullableBoolConverter.cs
- SubpageParaClient.cs
- ModelFunctionTypeElement.cs
- ParameterInfo.cs
- StructuralType.cs
- SizeChangedInfo.cs
- FixedSOMElement.cs
- EntityDataSourceMemberPath.cs
- BitVector32.cs
- IdentityModelDictionary.cs
- LinkConverter.cs
- SymmetricSecurityProtocolFactory.cs
- _FtpDataStream.cs
- CompilerParameters.cs
- ProtocolsSection.cs
- ValidationEventArgs.cs
- TableCell.cs
- SqlAggregateChecker.cs
- EventToken.cs