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
- Module.cs
- ContentControl.cs
- FrameworkTextComposition.cs
- ScriptingProfileServiceSection.cs
- ParameterCollection.cs
- PartialList.cs
- SafeThemeHandle.cs
- SqlMethodTransformer.cs
- QuotedStringWriteStateInfo.cs
- XmlReaderSettings.cs
- ServicePointManager.cs
- FileDialog_Vista_Interop.cs
- SelectionManager.cs
- DBConnection.cs
- CalendarDay.cs
- ContainerParagraph.cs
- XPathParser.cs
- EdmToObjectNamespaceMap.cs
- OdbcPermission.cs
- MethodImplAttribute.cs
- ModelTypeConverter.cs
- CodeMemberMethod.cs
- UriSection.cs
- ObjectDataSourceSelectingEventArgs.cs
- SymbolDocumentInfo.cs
- DecimalAverageAggregationOperator.cs
- IList.cs
- JsonClassDataContract.cs
- WmlLabelAdapter.cs
- DataMemberFieldEditor.cs
- ScriptControl.cs
- LinkUtilities.cs
- SqlDataSourceSelectingEventArgs.cs
- SqlIdentifier.cs
- HttpRequest.cs
- WindowsRichEdit.cs
- ClassData.cs
- MenuItemStyleCollectionEditor.cs
- DataControlFieldCell.cs
- EventLogTraceListener.cs
- ArgumentException.cs
- HtmlAnchor.cs
- LoginView.cs
- StatusBarDrawItemEvent.cs
- ExpandoClass.cs
- BitFlagsGenerator.cs
- Message.cs
- TextPattern.cs
- CaseInsensitiveHashCodeProvider.cs
- AuthorizationSection.cs
- PageCatalogPart.cs
- ListViewDataItem.cs
- Normalization.cs
- Range.cs
- RegisteredDisposeScript.cs
- ControlBuilderAttribute.cs
- Odbc32.cs
- TemplateBindingExtensionConverter.cs
- SymmetricAlgorithm.cs
- NamedElement.cs
- ContextBase.cs
- TitleStyle.cs
- Point4D.cs
- ListViewDataItem.cs
- ToolbarAUtomationPeer.cs
- Opcode.cs
- ApplyTemplatesAction.cs
- ManagedWndProcTracker.cs
- DispatcherEventArgs.cs
- ImageFormatConverter.cs
- ProvidersHelper.cs
- SizeAnimation.cs
- LinqDataSourceDeleteEventArgs.cs
- MobileControlsSectionHelper.cs
- ExtentKey.cs
- HttpListenerException.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- PointLight.cs
- ComboBoxAutomationPeer.cs
- NamespaceListProperty.cs
- TraceSection.cs
- AttributeCallbackBuilder.cs
- WebEventCodes.cs
- TreeViewAutomationPeer.cs
- SafeNativeMethods.cs
- RecognitionResult.cs
- PersonalizationStateQuery.cs
- SizeChangedEventArgs.cs
- TypedTableGenerator.cs
- DisplayInformation.cs
- EdmEntityTypeAttribute.cs
- WinInetCache.cs
- DataGridViewColumnHeaderCell.cs
- FormViewRow.cs
- FontStyleConverter.cs
- DataObjectSettingDataEventArgs.cs
- ParameterModifier.cs
- CounterSample.cs
- _AutoWebProxyScriptHelper.cs
- TableHeaderCell.cs