Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Misc / MultitargetUtil.cs / 1305376 / MultitargetUtil.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Resources { using System; ////// Helper class supporting Multitarget type assembly qualified name resolution for ResX API. /// Note: this file is compiled into different assemblies (runtime and VSIP assemblies ...) /// internal static class MultitargetUtil { ////// This method gets assembly info for the corresponding type. If the delegate /// is provided it is used to get this information. /// public static string GetAssemblyQualifiedName(Type type, FunctypeNameConverter) { string assemblyQualifiedName = null; if (type != null) { if (typeNameConverter != null) { try { assemblyQualifiedName = typeNameConverter(type); } catch (Exception e) { if (IsSecurityOrCriticalException(e)) { throw; } } } if (string.IsNullOrEmpty(assemblyQualifiedName)) { assemblyQualifiedName = type.AssemblyQualifiedName; } } return assemblyQualifiedName; } // ExecutionEngineException is obsolete and shouldn't be used (to catch, throw or reference) anymore. // Pragma added to prevent converting the "type is obsolete" warning into build error. #pragma warning disable 618 private static bool IsSecurityOrCriticalException(Exception ex) { return ex is NullReferenceException || ex is StackOverflowException || ex is OutOfMemoryException || ex is System.Threading.ThreadAbortException || ex is ExecutionEngineException || ex is IndexOutOfRangeException || ex is AccessViolationException || ex is System.Security.SecurityException; } #pragma warning restore 618 } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Resources { using System; ////// Helper class supporting Multitarget type assembly qualified name resolution for ResX API. /// Note: this file is compiled into different assemblies (runtime and VSIP assemblies ...) /// internal static class MultitargetUtil { ////// This method gets assembly info for the corresponding type. If the delegate /// is provided it is used to get this information. /// public static string GetAssemblyQualifiedName(Type type, FunctypeNameConverter) { string assemblyQualifiedName = null; if (type != null) { if (typeNameConverter != null) { try { assemblyQualifiedName = typeNameConverter(type); } catch (Exception e) { if (IsSecurityOrCriticalException(e)) { throw; } } } if (string.IsNullOrEmpty(assemblyQualifiedName)) { assemblyQualifiedName = type.AssemblyQualifiedName; } } return assemblyQualifiedName; } // ExecutionEngineException is obsolete and shouldn't be used (to catch, throw or reference) anymore. // Pragma added to prevent converting the "type is obsolete" warning into build error. #pragma warning disable 618 private static bool IsSecurityOrCriticalException(Exception ex) { return ex is NullReferenceException || ex is StackOverflowException || ex is OutOfMemoryException || ex is System.Threading.ThreadAbortException || ex is ExecutionEngineException || ex is IndexOutOfRangeException || ex is AccessViolationException || ex is System.Security.SecurityException; } #pragma warning restore 618 } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- EventLogEntryCollection.cs
- SafePEFileHandle.cs
- ConfigurationManager.cs
- DBPropSet.cs
- Currency.cs
- MLangCodePageEncoding.cs
- FilteredDataSetHelper.cs
- SqlConnectionHelper.cs
- GlyphRun.cs
- ByteFacetDescriptionElement.cs
- AmbientLight.cs
- UniqueIdentifierService.cs
- BuildProviderCollection.cs
- HotSpotCollection.cs
- EntryWrittenEventArgs.cs
- TextBlock.cs
- CancelEventArgs.cs
- MetadataCache.cs
- StrokeDescriptor.cs
- Win32.cs
- Operand.cs
- InternalBufferOverflowException.cs
- counter.cs
- DbBuffer.cs
- BitmapCodecInfo.cs
- NumberFormatter.cs
- PropertyDescriptors.cs
- WrapPanel.cs
- GeometryHitTestResult.cs
- TextSegment.cs
- ControlParser.cs
- ExceptionUtility.cs
- exports.cs
- ChameleonKey.cs
- WithParamAction.cs
- TTSVoice.cs
- SQLInt32Storage.cs
- TextSelectionProcessor.cs
- SocketSettings.cs
- pingexception.cs
- PropertyValueEditor.cs
- Thread.cs
- TriggerCollection.cs
- DesignerInterfaces.cs
- Select.cs
- StructureChangedEventArgs.cs
- SelfSignedCertificate.cs
- WorkflowMarkupSerializationProvider.cs
- CustomTrackingRecord.cs
- HandlerBase.cs
- ObjectToIdCache.cs
- AtomPub10CategoriesDocumentFormatter.cs
- DataGridPageChangedEventArgs.cs
- XmlStreamStore.cs
- ExtendedProtectionPolicyTypeConverter.cs
- SiteMapDataSource.cs
- SqlDataSourceEnumerator.cs
- X509Certificate2.cs
- WebPartCancelEventArgs.cs
- ResourceIDHelper.cs
- Fonts.cs
- WindowInteropHelper.cs
- LabelEditEvent.cs
- SizeChangedEventArgs.cs
- EntityProviderServices.cs
- WindowsProgressbar.cs
- MdiWindowListStrip.cs
- InProcStateClientManager.cs
- SrgsOneOf.cs
- UnsupportedPolicyOptionsException.cs
- FileDialog.cs
- ViewPort3D.cs
- BaseCodePageEncoding.cs
- ImageDrawing.cs
- TimelineGroup.cs
- TemplateField.cs
- GridItemPatternIdentifiers.cs
- Button.cs
- dataSvcMapFileLoader.cs
- SafeSecurityHandles.cs
- IgnoreSectionHandler.cs
- Model3D.cs
- QilChoice.cs
- MarkupCompiler.cs
- EntitySetBaseCollection.cs
- DataSourceNameHandler.cs
- PointLight.cs
- ContextMenu.cs
- AuthenticationModeHelper.cs
- HtmlControl.cs
- ExpressionConverter.cs
- Visual.cs
- XmlNavigatorStack.cs
- StateRuntime.cs
- IUnknownConstantAttribute.cs
- LineGeometry.cs
- ListViewInsertionMark.cs
- MultipartContentParser.cs
- ResourceDescriptionAttribute.cs
- OdbcParameterCollection.cs