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
- cookieexception.cs
- HttpMethodAttribute.cs
- AnimationStorage.cs
- BorderGapMaskConverter.cs
- ScrollViewerAutomationPeer.cs
- EndpointAddressAugust2004.cs
- ReferencedAssemblyResolver.cs
- XmlDocumentViewSchema.cs
- CompositeTypefaceMetrics.cs
- CellParaClient.cs
- CompilationUnit.cs
- SimpleParser.cs
- PointKeyFrameCollection.cs
- DrawingVisualDrawingContext.cs
- IPAddressCollection.cs
- ChameleonKey.cs
- PersistChildrenAttribute.cs
- HandledEventArgs.cs
- DataObjectAttribute.cs
- HtmlWindowCollection.cs
- QueryFunctions.cs
- newitemfactory.cs
- TypedDataSetSchemaImporterExtensionFx35.cs
- BufferModeSettings.cs
- CqlIdentifiers.cs
- AmbiguousMatchException.cs
- WebWorkflowRole.cs
- EncodingTable.cs
- ToolStripContentPanelRenderEventArgs.cs
- DecimalConverter.cs
- MSAANativeProvider.cs
- RawUIStateInputReport.cs
- ProgressiveCrcCalculatingStream.cs
- SqlUDTStorage.cs
- NavigationService.cs
- GlobalEventManager.cs
- SmuggledIUnknown.cs
- EncryptedXml.cs
- SafeCryptoHandles.cs
- XmlSerializerFactory.cs
- Cursors.cs
- EventLogger.cs
- StackBuilderSink.cs
- PackWebRequestFactory.cs
- ParseHttpDate.cs
- DataTableMappingCollection.cs
- CodeExpressionCollection.cs
- IntSecurity.cs
- OutputCacheSettingsSection.cs
- ExceptionTrace.cs
- DefaultHttpHandler.cs
- sqlstateclientmanager.cs
- ControlCollection.cs
- Debugger.cs
- WebControlsSection.cs
- ResourceDictionaryCollection.cs
- WCFModelStrings.Designer.cs
- DataBindingExpressionBuilder.cs
- IPipelineRuntime.cs
- TransformValueSerializer.cs
- ConfigurationSettings.cs
- FamilyTypefaceCollection.cs
- CroppedBitmap.cs
- IntSecurity.cs
- cookiecontainer.cs
- GridView.cs
- SwitchDesigner.xaml.cs
- PerfCounterSection.cs
- ZipArchive.cs
- PagePropertiesChangingEventArgs.cs
- TransformedBitmap.cs
- OdbcDataReader.cs
- UrlPath.cs
- ExtentCqlBlock.cs
- RepeaterItem.cs
- UserControlParser.cs
- Crc32.cs
- ToolTip.cs
- EventMappingSettingsCollection.cs
- MemberAssignmentAnalysis.cs
- ManagementClass.cs
- AnimationClock.cs
- TextTreeObjectNode.cs
- CqlErrorHelper.cs
- SecurityUtils.cs
- GridViewPageEventArgs.cs
- MenuEventArgs.cs
- BatchParser.cs
- SafePEFileHandle.cs
- SqlHelper.cs
- MSAAEventDispatcher.cs
- SafeMemoryMappedFileHandle.cs
- SqlPersistenceProviderFactory.cs
- Types.cs
- contentDescriptor.cs
- CompiledRegexRunnerFactory.cs
- ResourceReferenceKeyNotFoundException.cs
- CryptoApi.cs
- MarshalDirectiveException.cs
- HGlobalSafeHandle.cs