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
- ToolboxItemAttribute.cs
- ContextConfiguration.cs
- ResourceDescriptionAttribute.cs
- MouseEventArgs.cs
- ParserContext.cs
- ObjectResult.cs
- WindowsAuthenticationEventArgs.cs
- WinFormsUtils.cs
- MulticastNotSupportedException.cs
- OrderedParallelQuery.cs
- TabletDeviceInfo.cs
- Soap11ServerProtocol.cs
- IsolatedStorageFilePermission.cs
- SharedStatics.cs
- FieldBuilder.cs
- TimeSpanConverter.cs
- PointCollection.cs
- SortDescription.cs
- ScriptBehaviorDescriptor.cs
- EditorBrowsableAttribute.cs
- DataMisalignedException.cs
- RSAPKCS1SignatureFormatter.cs
- CommentEmitter.cs
- Context.cs
- ColorConverter.cs
- EditorPartChrome.cs
- login.cs
- ValidatingPropertiesEventArgs.cs
- XmlAttributes.cs
- XmlSerializationWriter.cs
- AdditionalEntityFunctions.cs
- ResourceDescriptionAttribute.cs
- OleDbException.cs
- LinqDataSourceHelper.cs
- Thumb.cs
- ImageButton.cs
- WindowsFormsSynchronizationContext.cs
- TabControl.cs
- ExpressionBuilderContext.cs
- DependencyObject.cs
- Matrix3DConverter.cs
- ClientUriBehavior.cs
- DesignBindingValueUIHandler.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- ConfigXmlAttribute.cs
- CallContext.cs
- Exception.cs
- EventHandlersStore.cs
- HttpProfileGroupBase.cs
- ProfileSettingsCollection.cs
- Scene3D.cs
- SqlOuterApplyReducer.cs
- TextDecorationUnitValidation.cs
- RuleInfoComparer.cs
- EntryIndex.cs
- ExtractorMetadata.cs
- grammarelement.cs
- SymbolType.cs
- Lasso.cs
- ScrollProperties.cs
- EpmContentDeSerializer.cs
- TrustManagerMoreInformation.cs
- XhtmlBasicLiteralTextAdapter.cs
- IdleTimeoutMonitor.cs
- XsltCompileContext.cs
- ZipQueryOperator.cs
- TypeTypeConverter.cs
- GridSplitter.cs
- UnknownBitmapDecoder.cs
- SchemaExporter.cs
- XmlConverter.cs
- WorkflowTransactionService.cs
- StylusPointProperty.cs
- HandleCollector.cs
- StateWorkerRequest.cs
- Repeater.cs
- StatementContext.cs
- DateTimeParse.cs
- PolicyStatement.cs
- XPathNodeHelper.cs
- ProcessModelInfo.cs
- ContentElement.cs
- dataobject.cs
- ImageMap.cs
- LicenseException.cs
- ActivityInstanceMap.cs
- StackSpiller.Generated.cs
- UrlAuthorizationModule.cs
- AttachedPropertyMethodSelector.cs
- WindowsContainer.cs
- OletxVolatileEnlistment.cs
- Base64Stream.cs
- AndMessageFilterTable.cs
- LogArchiveSnapshot.cs
- CodeSubDirectoriesCollection.cs
- MulticastNotSupportedException.cs
- DescendantQuery.cs
- EventHandlersDesigner.cs
- ExtendedPropertyCollection.cs
- RtType.cs