Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- EasingFunctionBase.cs
- X509Certificate2.cs
- StaticDataManager.cs
- WCFServiceClientProxyGenerator.cs
- Identifier.cs
- ControlBindingsCollection.cs
- ILGenerator.cs
- Parser.cs
- GridViewRow.cs
- RegexCompilationInfo.cs
- SendActivityDesigner.cs
- SynchronizedDispatch.cs
- CompilationLock.cs
- RequestStatusBarUpdateEventArgs.cs
- RenderTargetBitmap.cs
- WebEventCodes.cs
- ProtocolInformationReader.cs
- KnownTypesHelper.cs
- odbcmetadatafactory.cs
- ApplicationDirectoryMembershipCondition.cs
- XmlSchemaException.cs
- RunWorkerCompletedEventArgs.cs
- CommentAction.cs
- PrintDialogException.cs
- BaseTreeIterator.cs
- IDQuery.cs
- TextMarkerSource.cs
- DashStyle.cs
- UmAlQuraCalendar.cs
- DataPointer.cs
- ToolStripInSituService.cs
- MoveSizeWinEventHandler.cs
- Mappings.cs
- EnumUnknown.cs
- ListBoxAutomationPeer.cs
- unitconverter.cs
- Zone.cs
- DuplicateDetector.cs
- CodeTypeDeclaration.cs
- CopyOfAction.cs
- BinaryOperationBinder.cs
- SqlParameterCollection.cs
- ConstraintEnumerator.cs
- _KerberosClient.cs
- RemotingConfiguration.cs
- PropertyGridView.cs
- RemotingServices.cs
- HostedHttpContext.cs
- DCSafeHandle.cs
- BaseAppDomainProtocolHandler.cs
- ButtonBaseDesigner.cs
- KerberosRequestorSecurityToken.cs
- WinFormsComponentEditor.cs
- PageRanges.cs
- Pair.cs
- ConstraintConverter.cs
- EntitySetRetriever.cs
- DefaultPrintController.cs
- AutomationTextAttribute.cs
- SerializationStore.cs
- AnyAllSearchOperator.cs
- ParallelLoopState.cs
- FileLogRecord.cs
- XmlQualifiedName.cs
- HwndTarget.cs
- ConnectionModeReader.cs
- SHA256CryptoServiceProvider.cs
- Renderer.cs
- ListControl.cs
- EncryptedXml.cs
- SchemaElement.cs
- TraceHandlerErrorFormatter.cs
- EdmScalarPropertyAttribute.cs
- SqlDataSourceCache.cs
- HwndProxyElementProvider.cs
- MsmqIntegrationBindingCollectionElement.cs
- ReadOnlyHierarchicalDataSource.cs
- ProfileProvider.cs
- StopStoryboard.cs
- StrokeSerializer.cs
- DefinitionBase.cs
- IsolatedStoragePermission.cs
- SynchronizedDispatch.cs
- IPEndPointCollection.cs
- ComplexLine.cs
- DataGridHeaderBorder.cs
- SynchronizedDispatch.cs
- OpCodes.cs
- OperationContractGenerationContext.cs
- UncommonField.cs
- HtmlTableRowCollection.cs
- RadioButtonList.cs
- BaseValidatorDesigner.cs
- NegationPusher.cs
- UntypedNullExpression.cs
- TextEditorParagraphs.cs
- TableParagraph.cs
- FileRecordSequenceHelper.cs
- TreeNodeEventArgs.cs
- RemoveStoryboard.cs