Ejemplo n.º 1
0
 public ModuleData(string netModuleName, ImmutableArray<byte> image, ImmutableArray<byte> pdb, bool inMemoryModule)
 {
     this.Id = new ModuleDataId(netModuleName, netModuleName, GetMvid(image));
     this.Kind = OutputKind.NetModule;
     this.Image = image;
     this.Pdb = pdb;
     this.InMemoryModule = inMemoryModule;
 }
Ejemplo n.º 2
0
 public ModuleData(AssemblyIdentity identity, OutputKind kind, ImmutableArray<byte> image, ImmutableArray<byte> pdb, bool inMemoryModule)
 {
     this.Id = new ModuleDataId(identity.Name, identity.GetDisplayName(), GetMvid(image));
     this.Kind = kind;
     this.Image = image;
     this.Pdb = pdb;
     this.InMemoryModule = inMemoryModule;
 }
Ejemplo n.º 3
0
 public ModuleData(ModuleDataId id, OutputKind kind, ImmutableArray <byte> image, ImmutableArray <byte> pdb, bool inMemoryModule)
 {
     this.Id             = id;
     this.Kind           = kind;
     this.Image          = image;
     this.Pdb            = pdb;
     this.InMemoryModule = inMemoryModule;
 }
Ejemplo n.º 4
0
 public ModuleData(AssemblyIdentity identity, OutputKind kind, ImmutableArray <byte> image, ImmutableArray <byte> pdb, bool inMemoryModule)
 {
     this.Id             = new ModuleDataId(identity.Name, identity.GetDisplayName(), GetMvid(image));
     this.Kind           = kind;
     this.Image          = image;
     this.Pdb            = pdb;
     this.InMemoryModule = inMemoryModule;
 }
Ejemplo n.º 5
0
 public ModuleData(string netModuleName, ImmutableArray <byte> image, ImmutableArray <byte> pdb, bool inMemoryModule)
 {
     this.Id             = new ModuleDataId(netModuleName, netModuleName, GetMvid(image));
     this.Kind           = OutputKind.NetModule;
     this.Image          = image;
     this.Pdb            = pdb;
     this.InMemoryModule = inMemoryModule;
 }
Ejemplo n.º 6
0
        private bool TryGetMatchingByFullName(ModuleDataId id, out AssemblyData assemblyData, out bool fullMatch)
        {
            if (_fullNameToAssemblyDataMap.TryGetValue(id.FullName, out assemblyData))
            {
                fullMatch = _preloadedSet.Contains(id.SimpleName) || id.Mvid == assemblyData.Id.Mvid;
                return(true);
            }

            assemblyData = default(AssemblyData);
            fullMatch    = false;
            return(false);
        }
Ejemplo n.º 7
0
        internal Assembly GetOrDefault(ModuleDataId id, bool reflectionOnly)
        {
            var cache = reflectionOnly ? _reflectionOnlyAssemblyCache : _assemblyCache;
            lock (s_guard)
            {
                Assembly assembly;
                if (cache.TryGetValue(id.Mvid, out assembly))
                {
                    return assembly;
                }

                return null;
            }
        }
Ejemplo n.º 8
0
        internal Assembly GetOrDefault(ModuleDataId id, bool reflectionOnly)
        {
            var cache = reflectionOnly ? _reflectionOnlyAssemblyCache : _assemblyCache;

            lock (s_guard)
            {
                Assembly assembly;
                if (cache.TryGetValue(id.Mvid, out assembly))
                {
                    return(assembly);
                }

                return(null);
            }
        }
Ejemplo n.º 9
0
        private RuntimeData CreateAndInitializeRuntimeData(IEnumerable <ModuleData> compilationDependencies, ModuleDataId mainModuleId)
        {
            var allModules = compilationDependencies;

            if (_additionalDependencies != null)
            {
                allModules = allModules.Concat(_additionalDependencies);
            }

            allModules = allModules.ToArray();

            var runtimeData = GetOrCreateRuntimeData(allModules);

            // Many prominent assemblys like mscorlib are already in the RuntimeAssemblyManager.  Only
            // add in the delta values to reduce serialization overhead going across AppDomains.
            var manager     = runtimeData.Manager;
            var missingList = manager.GetMissing(allModules.Select(x => x.Id).ToList());
            var deltaList   = allModules.Where(x => missingList.Contains(x.Id)).ToList();

            manager.AddModuleData(deltaList);
            manager.AddMainModuleMvid(mainModuleId.Mvid);

            return(runtimeData);
        }
        private RuntimeData CreateAndInitializeRuntimeData(IEnumerable<ModuleData> compilationDependencies, ModuleDataId mainModuleId)
        {
            var allModules = compilationDependencies;
            if (_additionalDependencies != null)
            {
                allModules = allModules.Concat(_additionalDependencies);
            }

            allModules = allModules.ToArray();

            var runtimeData = GetOrCreateRuntimeData(allModules);

            // Many prominent assemblys like mscorlib are already in the RuntimeAssemblyManager.  Only 
            // add in the delta values to reduce serialization overhead going across AppDomains.
            var manager = runtimeData.Manager;
            var missingList = manager.GetMissing(allModules.Select(x => x.Id).ToList());
            var deltaList = allModules.Where(x => missingList.Contains(x.Id)).ToList();
            manager.AddModuleData(deltaList);
            manager.AddMainModuleMvid(mainModuleId.Mvid);

            return runtimeData;
        }
Ejemplo n.º 11
0
        private bool TryGetMatchingByFullName(ModuleDataId id, out AssemblyData assemblyData, out bool fullMatch)
        {
            if (_fullNameToAssemblyDataMap.TryGetValue(id.FullName, out assemblyData))
            {
                fullMatch = _preloadedSet.Contains(id.SimpleName) || id.Mvid == assemblyData.Id.Mvid;
                return true;
            }

            assemblyData = default(AssemblyData);
            fullMatch = false;
            return false;
        }
Ejemplo n.º 12
0
 private ModuleData(SerializationInfo info, StreamingContext context)
 {
     this.Id = (ModuleDataId)info.GetValue(nameof(Id), typeof(ModuleDataId));
     this.Kind = (OutputKind)info.GetInt32(nameof(Kind));
     this.Image = info.GetByteArray(nameof(Image));
     this.Pdb = info.GetByteArray(nameof(Pdb));
     this.InMemoryModule = info.GetBoolean(nameof(InMemoryModule));
 }