internal Type GetControlType(string tagName, IDictionary attribs, bool throwOnError) { string typeName; string ns = _nsRegisterEntry.Namespace; if (String.IsNullOrEmpty(ns)) { typeName = tagName; } else { typeName = ns + "." + tagName; } // Look up the type name (case insensitive) if (_assembly != null) { Type type = null; if (throwOnError) { // If loading the type from the assembly depends on a referenced assembly that cannot // be loaded, we should throw the actual exception, instead of later reporting a more // generic error saying the type was not found (Devdiv 138674) try { type = _assembly.GetType(typeName, true /*throwOnError*/, true /*ignoreCase*/); } catch (System.IO.FileNotFoundException) { throw; } catch (System.IO.FileLoadException) { throw; } catch (BadImageFormatException) { throw; } catch { // For all other exceptions, such as when the type is not present in the assembly, // we ignore the exception so that we can continue to check other assemblies to look // for the type. } } else { type = _assembly.GetType(typeName, false /*throwOnError*/, true /*ignoreCase*/); } return(type); } #if !FEATURE_PAL // If we're in the designer, check the WebFormsReferenceManager and ITypeResolutionService first. if (_parser.FInDesigner && (_parser.DesignerHost != null)) { // If we are in the DesignTimeThemes Host, we can't actually go down this code path, let the TypeResolutionService try instead if (_parser.DesignerHost.RootComponent != null) { WebFormsRootDesigner rootDesigner = _parser.DesignerHost.GetDesigner(_parser.DesignerHost.RootComponent) as WebFormsRootDesigner; if (rootDesigner != null) { WebFormsReferenceManager referenceManager = rootDesigner.ReferenceManager; if (referenceManager != null) { Type type = referenceManager.GetType(_nsRegisterEntry.TagPrefix, tagName); if (type != null) { // Only return the type if we found it. Otherwise fall back to the next service. return(type); } } } } ITypeResolutionService typeResolutionService = (ITypeResolutionService)_parser.DesignerHost.GetService(typeof(ITypeResolutionService)); if (typeResolutionService != null) { Type type = typeResolutionService.GetType(typeName, false, true); if (type != null) { // Only return the type if we found it. Otherwise fall back to the next service. return(type); } } } #endif // !FEATURE_PAL // Nothing more to try in non-hosted appdomains if (!HostingEnvironment.IsHosted) { return(null); } // If the assembly was not specified, look for the type in the code assemblies (including sub code assemblies) return(BuildManager.GetTypeFromCodeAssembly(typeName, true /*ignoreCase*/)); }
internal Type GetControlType(string tagName, IDictionary attribs, bool throwOnError) { string str; string str2 = this._nsRegisterEntry.Namespace; if (string.IsNullOrEmpty(str2)) { str = tagName; } else { str = str2 + "." + tagName; } if (this._assembly != null) { Type type = null; if (throwOnError) { try { return(this._assembly.GetType(str, true, true)); } catch (FileNotFoundException) { throw; } catch (FileLoadException) { throw; } catch (BadImageFormatException) { throw; } catch { return(type); } } return(this._assembly.GetType(str, false, true)); } if (this._parser.FInDesigner && (this._parser.DesignerHost != null)) { if (this._parser.DesignerHost.RootComponent != null) { WebFormsRootDesigner designer = this._parser.DesignerHost.GetDesigner(this._parser.DesignerHost.RootComponent) as WebFormsRootDesigner; if (designer != null) { WebFormsReferenceManager referenceManager = designer.ReferenceManager; if (referenceManager != null) { Type type2 = referenceManager.GetType(this._nsRegisterEntry.TagPrefix, tagName); if (type2 != null) { return(type2); } } } } ITypeResolutionService service = (ITypeResolutionService)this._parser.DesignerHost.GetService(typeof(ITypeResolutionService)); if (service != null) { Type type3 = service.GetType(str, false, true); if (type3 != null) { return(type3); } } } if (!HostingEnvironment.IsHosted) { return(null); } return(BuildManager.GetTypeFromCodeAssembly(str, true)); }