public XamlType ResolveType(ushort id) { XamlType xamlType; if (typeMap.TryGetValue(id, out xamlType)) { return(xamlType); } ITypeDefOrRef type; IAssembly assembly; if (id > 0x7fff) { type = Baml.KnownThings.Types((KnownTypes)(-id)); assembly = type.DefinitionAssembly; } else { var typeRec = Baml.TypeIdMap[id]; assembly = Baml.ResolveAssembly(typeRec.AssemblyId); type = TypeNameParser.ParseReflectionThrow(Module, typeRec.TypeFullName, new DummyAssemblyRefFinder(assembly)); } var clrNs = type.ReflectionNamespace; var xmlNs = XmlNs.LookupXmlns(assembly, clrNs); typeMap[id] = xamlType = new XamlType(assembly, clrNs, type.ReflectionName, GetXmlNamespace(xmlNs)) { ResolvedType = type }; return(xamlType); }