void UpdateCompilation()
        {
            const string        dummyAsmName = "CompiledAspNetPage";
            IUnresolvedAssembly asm          = new DefaultUnresolvedAssembly(dummyAsmName);

            compilation = new SimpleCompilation(asm, GetReferencedAssemblies());
        }
예제 #2
0
        public static ICompilation CreateCompilation(params IUnresolvedTypeDefinition[] unresolvedTypeDefinitions)
        {
            var unresolvedAsm = new DefaultUnresolvedAssembly("dummy");

            foreach (var typeDef in unresolvedTypeDefinitions)
            {
                unresolvedAsm.AddTypeDefinition(typeDef);
            }
            return(new SimpleCompilation(unresolvedAsm, TypeSystemLoaderTests.Mscorlib, TypeSystemLoaderTests.SystemCore));
        }
        internal static Task <IUnresolvedAssembly> LoadModuleAsync(Module module, ICorDebugModule corModule)
        {
            string name = corModule.GetName();

            if (corModule.IsDynamic() == 1 || corModule.IsInMemory() == 1)
            {
                var defaultUnresolvedAssembly = new DefaultUnresolvedAssembly(name);
                weakTable.Add(defaultUnresolvedAssembly, new ModuleMetadataInfo(module, null));
                return(Task.FromResult <IUnresolvedAssembly>(defaultUnresolvedAssembly));
            }

            //return Task.FromResult(LoadModule(module, name));
            return(Task.Run(() => LoadModule(module, name)));
        }
        internal static Task <IUnresolvedAssembly> LoadModuleAsync(Module module, ICorDebugModule corModule)
        {
            string name = corModule.GetName();

            if (corModule.IsDynamic() == 1 || corModule.IsInMemory() == 1)
            {
                var defaultUnresolvedAssembly       = new DefaultUnresolvedAssembly(name);
                var defaultUnresolvedTypeDefinition = new DefaultUnresolvedTypeDefinition("UnknownDynamicType");
                var defaultUnresolvedMethod         = new DefaultUnresolvedMethod(defaultUnresolvedTypeDefinition, "UnknownMethod");
                var defaultUnresolvedField          = new DefaultUnresolvedField(defaultUnresolvedTypeDefinition, "UnknownField");
                defaultUnresolvedTypeDefinition.Members.Add(defaultUnresolvedMethod);
                defaultUnresolvedTypeDefinition.Members.Add(defaultUnresolvedField);
                defaultUnresolvedAssembly.AddTypeDefinition(defaultUnresolvedTypeDefinition);
                weakTable.Add(defaultUnresolvedAssembly, new ModuleMetadataInfo(module, null));
                return(Task.FromResult <IUnresolvedAssembly>(defaultUnresolvedAssembly));
            }

            //return Task.FromResult(LoadModule(module, name));
            return(Task.Run(() => LoadModule(module, name)));
        }