public AssemblyFeatureInfo(EcmaModule module, IReadOnlyDictionary <string, bool> featureSwitchValues) { Module = module; RemovedAttributes = new HashSet <TypeDesc>(); PEMemoryBlock resourceDirectory = module.PEReader.GetSectionData(module.PEReader.PEHeaders.CorHeader.ResourcesDirectory.RelativeVirtualAddress); foreach (var resourceHandle in module.MetadataReader.ManifestResources) { ManifestResource resource = module.MetadataReader.GetManifestResource(resourceHandle); // Don't try to process linked resources or resources in other assemblies if (!resource.Implementation.IsNil) { continue; } string resourceName = module.MetadataReader.GetString(resource.Name); if (resourceName == "ILLink.LinkAttributes.xml") { BlobReader reader = resourceDirectory.GetReader((int)resource.Offset, resourceDirectory.Length - (int)resource.Offset); int length = (int)reader.ReadUInt32(); UnmanagedMemoryStream ms; unsafe { ms = new UnmanagedMemoryStream(reader.CurrentPointer, length); } RemovedAttributes = LinkAttributesReader.GetRemovedAttributes(module.Context, XmlReader.Create(ms), module, featureSwitchValues); } } }
public static HashSet <TypeDesc> GetRemovedAttributes(TypeSystemContext context, XmlReader reader, ModuleDesc module, IReadOnlyDictionary <string, bool> featureSwitchValues) { var rdr = new LinkAttributesReader(context, reader, module, featureSwitchValues); rdr.ProcessXml(); return(rdr._removedAttributes); }