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
- HostingEnvironmentWrapper.cs
- Currency.cs
- _SpnDictionary.cs
- dbdatarecord.cs
- GeneralTransform.cs
- EntityWrapper.cs
- TextTreeInsertUndoUnit.cs
- dataprotectionpermission.cs
- XmlTextEncoder.cs
- _UriSyntax.cs
- baseshape.cs
- SpoolingTaskBase.cs
- NewItemsContextMenuStrip.cs
- MessageSmuggler.cs
- SecurityToken.cs
- DataBindingHandlerAttribute.cs
- BezierSegment.cs
- __FastResourceComparer.cs
- OutputScopeManager.cs
- RuntimeConfig.cs
- LiteralDesigner.cs
- X509RecipientCertificateServiceElement.cs
- InkCanvasInnerCanvas.cs
- PlaceHolder.cs
- sitestring.cs
- Exceptions.cs
- TreeViewImageKeyConverter.cs
- FixedTextPointer.cs
- Variant.cs
- KeyboardEventArgs.cs
- Rectangle.cs
- FixedSOMLineRanges.cs
- FieldMetadata.cs
- XPathNodeList.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- login.cs
- DefaultSerializationProviderAttribute.cs
- NullableDecimalMinMaxAggregationOperator.cs
- DynamicILGenerator.cs
- LinqDataSourceContextData.cs
- SqlVersion.cs
- TableParagraph.cs
- GroupQuery.cs
- BamlLocalizer.cs
- ToolStripGrip.cs
- QuadraticBezierSegment.cs
- MSHTMLHost.cs
- ADMembershipUser.cs
- SystemPens.cs
- SizeLimitedCache.cs
- SymDocumentType.cs
- StylusPointPropertyInfoDefaults.cs
- SqlBulkCopy.cs
- DetailsViewPagerRow.cs
- ArglessEventHandlerProxy.cs
- XmlSerializerObjectSerializer.cs
- SafeHandle.cs
- DataGrid.cs
- ReturnEventArgs.cs
- AttributeEmitter.cs
- TextEffect.cs
- SafeNativeMethods.cs
- ParseChildrenAsPropertiesAttribute.cs
- TokenizerHelper.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- DictionaryEditChange.cs
- HtmlTitle.cs
- DesignerLabelAdapter.cs
- DependencyProperty.cs
- InkCanvasSelectionAdorner.cs
- AnnotationAuthorChangedEventArgs.cs
- ValidatingPropertiesEventArgs.cs
- Pkcs7Recipient.cs
- Interlocked.cs
- FixedTextView.cs
- DataListItemCollection.cs
- DataSetViewSchema.cs
- BuildResultCache.cs
- SiteIdentityPermission.cs
- XsltContext.cs
- DesignerGenericWebPart.cs
- EmbeddedMailObject.cs
- XmlRawWriter.cs
- RuleSetReference.cs
- BindingContext.cs
- ConfigXmlCDataSection.cs
- DrawingImage.cs
- AccessDataSourceView.cs
- HelpEvent.cs
- PeerTransportSecurityElement.cs
- NativeCompoundFileAPIs.cs
- StylusPoint.cs
- SQLSingleStorage.cs
- SimpleType.cs
- DesignerView.cs
- RelatedEnd.cs
- InstanceKeyView.cs
- FunctionNode.cs
- HttpInputStream.cs
- SafeHandle.cs