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
- QilInvokeEarlyBound.cs
- DifferencingCollection.cs
- PartialTrustHelpers.cs
- DataGridRow.cs
- Int64Storage.cs
- SafeSecurityHandles.cs
- DataGridViewRowsRemovedEventArgs.cs
- DataGridCommandEventArgs.cs
- Restrictions.cs
- EventLogConfiguration.cs
- MappedMetaModel.cs
- SpellerError.cs
- GlobalEventManager.cs
- MessagePropertyDescriptionCollection.cs
- ListParagraph.cs
- TreeViewAutomationPeer.cs
- SystemIPInterfaceStatistics.cs
- Literal.cs
- MultiAsyncResult.cs
- SystemDiagnosticsSection.cs
- EmptyCollection.cs
- WCFBuildProvider.cs
- PackageDigitalSignatureManager.cs
- BlockCollection.cs
- SamlAuthenticationStatement.cs
- KeyTimeConverter.cs
- FixedSOMSemanticBox.cs
- SerializationFieldInfo.cs
- Odbc32.cs
- SafeHandles.cs
- LinkedResourceCollection.cs
- AuthenticationService.cs
- TextAdaptor.cs
- SqlClientWrapperSmiStreamChars.cs
- RegexMatchCollection.cs
- GradientStopCollection.cs
- DiscoveryEndpointElement.cs
- RealizationDrawingContextWalker.cs
- SapiInterop.cs
- UserControlAutomationPeer.cs
- XmlHierarchicalEnumerable.cs
- SessionStateSection.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- Graph.cs
- WindowsListViewItem.cs
- EventHandlerList.cs
- XmlDataSourceNodeDescriptor.cs
- StrongNameMembershipCondition.cs
- Util.cs
- DataControlPagerLinkButton.cs
- UnsafeNetInfoNativeMethods.cs
- CodePrimitiveExpression.cs
- ToolStrip.cs
- Avt.cs
- NamespaceEmitter.cs
- SqlReorderer.cs
- NumberAction.cs
- BlockCollection.cs
- ClearCollection.cs
- CLRBindingWorker.cs
- assertwrapper.cs
- CustomValidator.cs
- ProtocolsConfiguration.cs
- datacache.cs
- MimeImporter.cs
- DataGridCell.cs
- EntityContainerEntitySetDefiningQuery.cs
- SoapDocumentServiceAttribute.cs
- Padding.cs
- PasswordDeriveBytes.cs
- CqlWriter.cs
- TimerElapsedEvenArgs.cs
- RSAPKCS1SignatureDeformatter.cs
- XmlObjectSerializerWriteContextComplex.cs
- PropertyTabAttribute.cs
- ListBoxAutomationPeer.cs
- DictionaryKeyPropertyAttribute.cs
- RectKeyFrameCollection.cs
- SiteMapProvider.cs
- UpdatePanelTriggerCollection.cs
- PKCS1MaskGenerationMethod.cs
- Rotation3DAnimation.cs
- PerspectiveCamera.cs
- ErrorsHelper.cs
- HtmlToClrEventProxy.cs
- SuppressMessageAttribute.cs
- ConnectionPoolManager.cs
- SkinIDTypeConverter.cs
- GridProviderWrapper.cs
- XsdDataContractImporter.cs
- OraclePermissionAttribute.cs
- DataGridViewTextBoxEditingControl.cs
- SqlStatistics.cs
- BuildProviderAppliesToAttribute.cs
- SmiEventSink.cs
- AuthenticatedStream.cs
- ComplexTypeEmitter.cs
- BinaryParser.cs
- HybridCollection.cs
- CalendarButton.cs