public ModuleDesc CreateModuleForSimpleName(string simpleName) { ModuleDesc module = new Internal.TypeSystem.Ecma.EcmaModule(this, new PEReader(File.OpenRead(simpleName + ".dll"))); _modules.Add(simpleName, module); return(module); }
public AssemblyFeatureInfo(EcmaModule module, IReadOnlyDictionary <string, bool> featureSwitchValues) { Module = module; BlockedResources = new HashSet <string>(); 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.Substitutions.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); } BlockedResources = SubstitutionsReader.GetSubstitutions(module.Context, XmlReader.Create(ms), module, featureSwitchValues); } } }
public bool GeneratesMetadata(EcmaModule module, ExportedTypeHandle exportedTypeHandle) { // We'll possibly need to do something else here if we ever use this MetadataManager // with compilation modes that generate multiple metadata blobs. // (Multi-module or .NET Native style shared library.) // We are currently missing type forwarders pointing to the other blobs. var targetType = (MetadataType)module.GetObject(exportedTypeHandle, NotFoundBehavior.ReturnNull); if (targetType == null) { // No harm in generating a forwarder that didn't resolve. // We'll get matching behavior at runtime. return(true); } return(GeneratesMetadata(targetType)); }
public ModuleDesc CreateModuleForSimpleName(string simpleName) { ModuleDesc module = new Internal.TypeSystem.Ecma.EcmaModule(this, new PEReader(File.OpenRead(simpleName + ".dll"))); _modules.Add(simpleName, module); return module; }
public SimpleTests() { _context = new TestTypeSystemContext(); _systemModule = _context.CreateModuleForSimpleName("PrimaryMetadataAssembly"); _context.SetSystemModule(_systemModule); }
public ReflectableCustomAttribute(EcmaModule module, CustomAttributeHandle caHandle) => (Module, CustomAttributeHandle) = (module, caHandle);
public bool GeneratesMetadata(EcmaModule module, CustomAttributeHandle caHandle) { return(_parent._reflectableAttributes.Contains(new ReflectableCustomAttribute(module, caHandle))); }