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
- BuildResultCache.cs
- DispatcherEventArgs.cs
- ViewStateChangedEventArgs.cs
- RegistryKey.cs
- ArrayTypeMismatchException.cs
- PointLight.cs
- EdmPropertyAttribute.cs
- XmlSerializationReader.cs
- PropVariant.cs
- Registry.cs
- ResourceExpressionBuilder.cs
- CssStyleCollection.cs
- Util.cs
- BooleanFunctions.cs
- OpCodes.cs
- AdRotator.cs
- DoubleCollection.cs
- BaseResourcesBuildProvider.cs
- XmlSchemaDatatype.cs
- DataGridViewRowEventArgs.cs
- StorageMappingItemLoader.cs
- _CommandStream.cs
- ListView.cs
- SystemEvents.cs
- DbLambda.cs
- DeadCharTextComposition.cs
- QilExpression.cs
- XmlSchemaSimpleContentRestriction.cs
- EraserBehavior.cs
- AssemblyHash.cs
- OracleConnectionFactory.cs
- Quaternion.cs
- HttpStreamMessageEncoderFactory.cs
- BindToObject.cs
- ModuleConfigurationInfo.cs
- ZipFileInfoCollection.cs
- BaseUriWithWildcard.cs
- TextRunCache.cs
- ConnectionStringsSection.cs
- TrustSection.cs
- CountdownEvent.cs
- TimeManager.cs
- DropTarget.cs
- HtmlTableRow.cs
- ObjectListSelectEventArgs.cs
- ToolStripDropDownItem.cs
- SqlCrossApplyToCrossJoin.cs
- CompositeDuplexElement.cs
- SourceFileBuildProvider.cs
- XmlEventCache.cs
- PointLight.cs
- Reference.cs
- SqlComparer.cs
- AesManaged.cs
- GridViewDeletedEventArgs.cs
- PropertyIDSet.cs
- UriParserTemplates.cs
- SettingsAttributes.cs
- PerformanceCounter.cs
- ReadOnlyAttribute.cs
- ClientSideQueueItem.cs
- CharAnimationUsingKeyFrames.cs
- PseudoWebRequest.cs
- OleCmdHelper.cs
- BoolExpression.cs
- ZipIOLocalFileHeader.cs
- StateRuntime.cs
- ArcSegment.cs
- IProvider.cs
- MarkupCompilePass1.cs
- XmlSchemaValidationException.cs
- HebrewNumber.cs
- EntityDataSourceStatementEditor.cs
- ADMembershipUser.cs
- ExternalException.cs
- DataServicePagingProviderWrapper.cs
- X509Certificate2Collection.cs
- DurableEnlistmentState.cs
- ScriptResourceMapping.cs
- StatusBar.cs
- DecoderBestFitFallback.cs
- _TransmitFileOverlappedAsyncResult.cs
- Button.cs
- BindValidationContext.cs
- SortableBindingList.cs
- TransactionFlowProperty.cs
- AttachedPropertyBrowsableAttribute.cs
- SeparatorAutomationPeer.cs
- wgx_commands.cs
- MatrixTransform3D.cs
- BeginEvent.cs
- HostedImpersonationContext.cs
- TranslateTransform3D.cs
- StopStoryboard.cs
- AssemblyBuilderData.cs
- PrimaryKeyTypeConverter.cs
- ObjectNavigationPropertyMapping.cs
- DynamicValidatorEventArgs.cs
- RightNameExpirationInfoPair.cs
- PackageRelationshipSelector.cs