diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/BamlMapTable.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/BamlMapTable.cs
index a1c0695fb04..34f40c2f942 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/BamlMapTable.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/BamlMapTable.cs
@@ -348,53 +348,6 @@ private static Type GetKnownConverterTypeFromPropName(
#region Methods
#if !PBTCOMPILER
- // This is called when a parse is begun when the very first baml record is
- // processed. If the BamlMapTable already contains data, then this means
- // it is being re-used for multiple parses. In this case set the _reusingMapTable
- // flag and make certain that the ObjectHashTable is populated before clearing
- // the existing assembly, type and property lists for the next parse.
- internal void Initialize()
- {
- if (AttributeIdMap.Count > 0 || TypeIdMap.Count > 0)
- {
- _reusingMapTable = true;
- // Populate the ObjectHashTable here only after the first parse has
- // completed and the second is about to begin. This is done so that
- // a single parse does not pay the price of having the hash table, and
- // the second through 'n' parses are added as they are read in.
- if (ObjectHashTable.Count == 0)
- {
- // Loop through attributes. We only care about having CLR properties in
- // the hash table. DependencyProperties are already cached by the framework.
- for (int i = 0; i < AttributeIdMap.Count; i++)
- {
- BamlAttributeInfoRecord info = AttributeIdMap[i];
- if (info.PropInfo != null)
- {
- object key = GetAttributeInfoKey(info.OwnerType.FullName, info.Name);
- ObjectHashTable.Add(key, info);
- }
- }
-
- // Loop through types and cache them.
- for (int j = 0; j < TypeIdMap.Count; j++)
- {
- BamlTypeInfoRecord info = TypeIdMap[j];
- if (info.Type != null)
- {
- BamlAssemblyInfoRecord assyInfo = GetAssemblyInfoFromId(info.AssemblyId);
- TypeInfoKey key = GetTypeInfoKey(assyInfo.AssemblyFullName, info.TypeFullName);
- ObjectHashTable.Add(key, info);
- }
- }
- }
- }
- AssemblyIdMap.Clear();
- TypeIdMap.Clear();
- AttributeIdMap.Clear();
- StringIdMap.Clear();
- }
-
// Given an Id looks up the Type in the MapTable. This works for known types
// and types that are a part of BamlTypeInfoRecords in the baml file.
internal Type GetTypeFromId(short id)
@@ -767,7 +720,6 @@ internal Type GetTypeFromTypeInfo(BamlTypeInfoRecord typeInfo)
{
Type type = assembly.GetType(typeInfo.TypeFullName);
typeInfo.Type = type;
- AddHashTableData(key, typeInfo);
}
}
}
@@ -1662,19 +1614,6 @@ internal Object GetHashTableData(object key)
return ObjectHashTable[key];
}
-#if !PBTCOMPILER
- // Add item to the hash table. Only do this if the map table
- // is being re-used for multiple parses. Otherwise the hash table
- // data is of no use for a single parse.
- internal void AddHashTableData(object key, object data)
- {
- if (_reusingMapTable)
- {
- ObjectHashTable[key] = data;
- }
- }
-#endif
-
#if !PBTCOMPILER
internal BamlMapTable Clone() => new BamlMapTable(_xamlTypeMapper)
{
@@ -1842,13 +1781,6 @@ private Hashtable ConverterCache
private Hashtable _converterCache = null;
#endif
-#if !PBTCOMPILER
- // True if this instance of the BamlMapTable is being reused between
- // different parses. This is done to maintain the ObjectHashTable so that
- // less reflection is done for types and properties.
- private bool _reusingMapTable = false;
-#endif
-
#endregion Data
}
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/BamlRecordReader.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/BamlRecordReader.cs
index f8d0f4f38ba..a73b5662cef 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/BamlRecordReader.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/BamlRecordReader.cs
@@ -142,7 +142,6 @@ protected internal BamlRecordReader()
///
internal void Initialize()
{
- MapTable.Initialize();
XamlTypeMapper.Initialize();
ParserContext.Initialize();
}
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XamlTypeMapper.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XamlTypeMapper.cs
index db07a72533e..7abc2250e70 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XamlTypeMapper.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XamlTypeMapper.cs
@@ -414,59 +414,6 @@ private void PreLoadDefaultAssemblies(string asmName, string asmPath)
#endregion AssemblyLoading
- #region Events
-
-#if !PBTCOMPILER
-
- ///
- /// Helper to map an Attribute to a RoutedEvent
- ///
- ///
- /// Example:
- /// If the xaml contained the tag
- /// you would call
- ///
- /// Type owner = XamlTypeMapper.GetType("BaseXmlNs","Button");
- /// RoutedEvent = XamlTypeMapper.GetRoutedEvent(owner,"MyClick","BaseXmlNs");
- ///
- /// Type of the owner
- /// Xml NamespaceURI of the attribute
- /// Local name of the attribute
- /// The RoutedEvent ID or null if no match was found
- ///
- internal RoutedEvent GetRoutedEvent(
- Type owner,
- string xmlNamespace,
- string localName)
- {
- Type baseType = null;
- string dynamicObjectName = null;
-
- if(null == localName)
- {
- throw new ArgumentNullException( nameof(localName));
- }
- if(null == xmlNamespace)
- {
- throw new ArgumentNullException( nameof(xmlNamespace));
- }
- if (owner != null && !ReflectionHelper.IsPublicType(owner))
- {
- _lineNumber = 0; // Public API, so we don't know the line number.
- ThrowException(nameof(SR.ParserOwnerEventMustBePublic), owner.FullName );
- }
-
- RoutedEvent Event = GetDependencyObject(true,owner,xmlNamespace,
- localName,ref baseType,ref dynamicObjectName)
- as RoutedEvent;
-
- return Event;
- }
-
-#endif
-
-#endregion Events
-
#region Properties
#if !PBTCOMPILER
@@ -785,20 +732,6 @@ private MemberInfo GetCachedMemberInfo(
}
#if !PBTCOMPILER
- ///
- /// Add cached member info for the property name.
- ///
- private void AddCachedAttributeInfo(
- Type ownerType,
- BamlAttributeInfoRecord infoRecord)
- {
- if (MapTable != null)
- {
- object key = MapTable.GetAttributeInfoKey(ownerType.FullName, infoRecord.Name);
- MapTable.AddHashTableData(key, infoRecord);
- }
- }
-
///
/// Helper function for getting Clr PropertyInfo on a type and updating the
/// passed attribute info record. Also update the property cache with this
@@ -837,10 +770,6 @@ internal void UpdateClrPropertyInfo(
cachedInfoRecord.SetPropertyMember(attribInfo.PropInfo);
cachedInfoRecord.IsInternal = attribInfo.IsInternal;
}
- else
- {
- AddCachedAttributeInfo(currentParentType, attribInfo);
- }
}
}
else
@@ -1096,22 +1025,6 @@ private bool IsAllowedMethod(MethodInfo mi, bool checkProtected)
return allowed;
}
#else
- // Checks to see if a given property's set method is public.
- // Used only in Xaml Load sceanrios.
- internal bool IsAllowedPropertySet(PropertyInfo pi)
- {
- MethodInfo mi = pi.GetSetMethod(true);
- return (mi != null && mi.IsPublic);
- }
-
- // Checks to see if a given property's get method is public.
- // Used only in Xaml Load sceanrios.
- internal bool IsAllowedPropertyGet(PropertyInfo pi)
- {
- MethodInfo mi = pi.GetGetMethod(true);
- return (mi != null && mi.IsPublic);
- }
-
// Checks to see if a given property's set method is accessible.
// Used only in compiled Baml Load sceanrios.
internal static bool IsAllowedPropertySet(PropertyInfo pi, bool allowProtected, out bool isPublic)
@@ -1605,141 +1518,6 @@ internal EventInfo GetClrEventInfo(
return eventInfo;
}
- ///
- /// Helper method to resolve an xml namespace and localName to
- /// either a RoutedEvent or a DependencyProperty. If they are not present,
- /// still resolve using a guess at the valid setter name to look for.
- ///
- ///
- /// Note that this will not resolve clr properties. Call GetClrInfo to do that.
- ///
- /// True if Event, False look for Property
- /// Type we should look for attribute on, can be null
- /// XmlNamespace or the Attribute
- /// local Name of the Attribute
- /// Base type the object was found on
- /// registered name of the Object on the type.
- /// resolved object, which can be a RoutedEvent, a DependencyProperty
- /// or the MethodInfo for the event or property setter
- internal object GetDependencyObject(
- bool isEvent,
- Type owner,
- string xmlNamespace,
- string localName,
- ref Type baseType,
- ref string dynamicObjectName)
- {
- Debug.Assert(null != localName, "null localName");
- Debug.Assert(null != xmlNamespace, "null xmlNamespace");
-
- object memInfo = null;
- string globalClassName = null;
-
- dynamicObjectName = null;
-
- // Extract the class name if there are any periods in the localName.
- int lastIndex = localName.LastIndexOf('.');
- if (-1 != lastIndex)
- {
- // if using .net then match against the class.
- globalClassName = localName.Substring(0,lastIndex);
- localName = localName.Substring(lastIndex+1);
- }
-
- // If this is a globalClassName then resolve the type and then call
- // DependencyProperty.FromName.
- if (null != globalClassName)
- {
- TypeAndSerializer typeAndSerializer =
- GetTypeOnly(xmlNamespace,globalClassName);
-
- if (typeAndSerializer != null && typeAndSerializer.ObjectType != null)
- {
- baseType = typeAndSerializer.ObjectType;
- if (isEvent)
- {
- memInfo = RoutedEventFromName(localName,baseType);
- }
- else
- {
- memInfo = DependencyProperty.FromName(localName, baseType);
- }
-
- if (null != memInfo)
- {
- Debug.Assert(null != baseType, "baseType not set");
- dynamicObjectName = localName;
- }
- }
- }
- else
- {
- NamespaceMapEntry[] namespaceMaps = GetNamespaceMapEntries(xmlNamespace);
-
- if (null == namespaceMaps)
- {
- return null;
- }
-
- baseType = owner;
-
- // See if the owner knows about this class.
- // Look for a parent type with any namespace matching the property
- while (null != baseType)
- {
- bool foundNamespaceMatch = false;
-
- // Look at each namespace for a match with this baseType
- for (int count = 0;
- count < namespaceMaps.Length && !foundNamespaceMatch;
- count ++)
- {
- NamespaceMapEntry namespaceMap = namespaceMaps[count];
-
- // see if the urtNamespace in the namespace map is valid
- // for the type we are trying to apply
- if (namespaceMap.ClrNamespace == GetCachedNamespace(baseType))
- {
- foundNamespaceMatch = true;
- }
- }
-
- if (foundNamespaceMatch)
- {
- // For 'normal' properties and events that are not prefixed by
- // a class name, only attempt to get dependency IDs and Events.
- // The caller should use GetClrInfo to get CLR properties for
- // 'normal' properties and events if this attempt fails.
- if (isEvent)
- {
- memInfo = RoutedEventFromName(localName,baseType);
- }
- else
- {
- memInfo = DependencyProperty.FromName(localName, baseType);
- }
- }
-
- // Only do one loop for events, since all base classes are checked in
- // a single operation. For properties, loop through the base classes here.
- if (null != memInfo || isEvent)
- {
- // for assembly and typeName use the original, not the base
- // type we found it on.
- dynamicObjectName = localName;
- break;
- }
- else
- {
- baseType = GetCachedBaseType(baseType);
- }
- }
- }
-
- return memInfo;
- }
-
-
///
/// Returns a DependencyProperty given a local name and an xml namespace
///
@@ -2740,17 +2518,6 @@ internal static Type GetInternalTypeHelperTypeFromAssembly(ParserContext pc)
return ithType;
}
- private static InternalTypeHelper GetInternalTypeHelperFromAssembly(ParserContext pc)
- {
- InternalTypeHelper ith = null;
- Type ithType = GetInternalTypeHelperTypeFromAssembly(pc);
- if (ithType != null)
- {
- ith = (InternalTypeHelper)Activator.CreateInstance(ithType);
- }
- return ith;
- }
-
internal static object CreateInternalInstance(ParserContext pc, Type type)
{
object instance = Activator.CreateInstance(type,
@@ -3068,27 +2835,6 @@ internal static DependencyProperty ParsePropertyName(
return dp;
}
- /***************************************************************************\
- *
- * XamlTypeMapper.ParseEventName
- *
- * Given an event name, find the associated RoutedEvent and return it.
- *
- \***************************************************************************/
-
- internal static RoutedEvent ParseEventName(
- ParserContext parserContext,
- string eventName,
- Type ownerType)
- {
- string namespaceURI = ProcessNameString(parserContext, ref eventName);
-
- RoutedEvent Event = parserContext.XamlTypeMapper.GetRoutedEvent(
- ownerType, namespaceURI, eventName);
-
- return Event;
- }
-
#endif
///