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
- WorkflowInstance.cs
- HostExecutionContextManager.cs
- FilterException.cs
- PageRequestManager.cs
- dataSvcMapFileLoader.cs
- PropertyInformationCollection.cs
- ApplicationInterop.cs
- XmlNamespaceMappingCollection.cs
- WindowInteractionStateTracker.cs
- ApplicationDirectoryMembershipCondition.cs
- SoapReflectionImporter.cs
- LogEntrySerializationException.cs
- GroupItem.cs
- KeySplineConverter.cs
- RecordConverter.cs
- FormView.cs
- DataGridViewRowEventArgs.cs
- FixedTextView.cs
- HyperLinkField.cs
- OracleTransaction.cs
- Msec.cs
- UIAgentCrashedException.cs
- IconEditor.cs
- FillRuleValidation.cs
- WindowsGrip.cs
- DataGrid.cs
- ToolStripPanelCell.cs
- SequenceDesigner.xaml.cs
- _AcceptOverlappedAsyncResult.cs
- BindValidationContext.cs
- SerializationFieldInfo.cs
- SystemColors.cs
- SqlDataSourceCustomCommandEditor.cs
- InvokeFunc.cs
- Crypto.cs
- Matrix.cs
- TextProperties.cs
- TableCellCollection.cs
- TreeViewItem.cs
- ValueConversionAttribute.cs
- WeakReference.cs
- Match.cs
- relpropertyhelper.cs
- Token.cs
- FormsAuthentication.cs
- DataRecord.cs
- SystemTcpConnection.cs
- DesignerEditorPartChrome.cs
- UrlParameterReader.cs
- PenThreadWorker.cs
- Quad.cs
- BooleanKeyFrameCollection.cs
- Function.cs
- ListBoxChrome.cs
- ArraySegment.cs
- NativeMethodsCLR.cs
- ThemeDirectoryCompiler.cs
- StagingAreaInputItem.cs
- DoubleLinkListEnumerator.cs
- ListView.cs
- IisTraceWebEventProvider.cs
- FixUp.cs
- LexicalChunk.cs
- EmptyControlCollection.cs
- UIElementIsland.cs
- Descriptor.cs
- RemotingHelper.cs
- Point.cs
- ContextMenuStripGroupCollection.cs
- StretchValidation.cs
- DetailsViewDeletedEventArgs.cs
- Queue.cs
- ScriptResourceInfo.cs
- handlecollector.cs
- WebPartDeleteVerb.cs
- UrlPropertyAttribute.cs
- ImageIndexConverter.cs
- ToolStripDropDownClosedEventArgs.cs
- CalendarButtonAutomationPeer.cs
- SaveFileDialog.cs
- FileLogRecordHeader.cs
- HttpTransportElement.cs
- IndexingContentUnit.cs
- Win32.cs
- DataViewManager.cs
- metrodevice.cs
- UrlPropertyAttribute.cs
- TypeDescriptionProviderAttribute.cs
- ContentPlaceHolder.cs
- DataGridItemAutomationPeer.cs
- UniqueEventHelper.cs
- HttpConfigurationContext.cs
- DataBindingCollectionEditor.cs
- InvalidOleVariantTypeException.cs
- SequenceNumber.cs
- ConfigurationManagerHelper.cs
- CompModSwitches.cs
- XmlSchemaSimpleContent.cs
- ThumbAutomationPeer.cs
- DataQuery.cs