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
- ToolboxComponentsCreatingEventArgs.cs
- SafePipeHandle.cs
- DbConvert.cs
- AsyncOperationLifetimeManager.cs
- Application.cs
- WebPartConnectionsConfigureVerb.cs
- ParameterBuilder.cs
- SchemaType.cs
- FormatterServices.cs
- HtmlInputRadioButton.cs
- EpmSourcePathSegment.cs
- HttpApplicationFactory.cs
- DynamicDataRouteHandler.cs
- AnnouncementInnerClient11.cs
- QuadraticBezierSegment.cs
- SystemColors.cs
- TextBounds.cs
- NativeMethods.cs
- ControlParameter.cs
- BaseProcessProtocolHandler.cs
- IISUnsafeMethods.cs
- ToolbarAUtomationPeer.cs
- ConfigurationManagerInternalFactory.cs
- Double.cs
- InlineUIContainer.cs
- DirectoryNotFoundException.cs
- PieceDirectory.cs
- HttpRequestCacheValidator.cs
- WizardStepBase.cs
- PublisherMembershipCondition.cs
- OleDbConnectionInternal.cs
- GridViewSelectEventArgs.cs
- DrawingBrush.cs
- ZoneIdentityPermission.cs
- TablePatternIdentifiers.cs
- WriteTimeStream.cs
- WsatServiceAddress.cs
- DataColumnSelectionConverter.cs
- MethodExpr.cs
- PrintController.cs
- Util.cs
- ContentFilePart.cs
- LambdaExpression.cs
- BooleanFunctions.cs
- TextEffect.cs
- InputLanguageSource.cs
- ServiceDesigner.cs
- Rectangle.cs
- EntityParameterCollection.cs
- WindowCollection.cs
- RawStylusInputCustomData.cs
- SqlConnectionPoolGroupProviderInfo.cs
- SectionRecord.cs
- SqlNotificationRequest.cs
- DurableInstanceProvider.cs
- ConfigurationLockCollection.cs
- OracleFactory.cs
- LinkLabelLinkClickedEvent.cs
- DataGridRelationshipRow.cs
- CatalogPart.cs
- IteratorFilter.cs
- WebBrowserDocumentCompletedEventHandler.cs
- Model3DCollection.cs
- XXXOnTypeBuilderInstantiation.cs
- GraphicsContainer.cs
- SurrogateEncoder.cs
- RadioButtonRenderer.cs
- GenericEnumConverter.cs
- PromptBuilder.cs
- PeerHelpers.cs
- MetadataArtifactLoaderResource.cs
- DataGridViewButtonColumn.cs
- HitTestWithGeometryDrawingContextWalker.cs
- TypedAsyncResult.cs
- MDIControlStrip.cs
- AtlasWeb.Designer.cs
- SelectionService.cs
- AspNetSynchronizationContext.cs
- Page.cs
- IPGlobalProperties.cs
- DataGridBoolColumn.cs
- GroupBox.cs
- DbDataAdapter.cs
- SQLInt16.cs
- TemplateXamlParser.cs
- WebPartDisplayMode.cs
- EntityCommandCompilationException.cs
- UInt32.cs
- sitestring.cs
- TypeUsage.cs
- ProxyFragment.cs
- RequestTimeoutManager.cs
- SerTrace.cs
- RightNameExpirationInfoPair.cs
- CollectionViewGroupInternal.cs
- GridItem.cs
- CanonicalFormWriter.cs
- DataListCommandEventArgs.cs
- BinaryFormatterSinks.cs
- CodeDomConfigurationHandler.cs