internal static ModuleInstance GetModuleInstanceForIL(string ilSource)
        {
            ImmutableArray <byte> peBytes;
            ImmutableArray <byte> pdbBytes;

            CommonTestBase.EmitILToArray(ilSource, appendDefaultHeader: true, includePdb: true, assemblyBytes: out peBytes, pdbBytes: out pdbBytes);
            return(ModuleInstance.Create(peBytes, SymReaderFactory.CreateReader(pdbBytes), includeLocalSignatures: true));
        }
        internal static ModuleInstance ToModuleInstance(
            this Compilation compilation,
            DebugInformationFormat debugFormat = DebugInformationFormat.Pdb,
            bool includeLocalSignatures        = true)
        {
            var pdbStream = (debugFormat != 0) ? new MemoryStream() : null;
            var peImage   = compilation.EmitToArray(new EmitOptions(debugInformationFormat: debugFormat), pdbStream: pdbStream);
            var symReader = (debugFormat != 0) ? SymReaderFactory.CreateReader(pdbStream, new PEReader(peImage)) : null;

            return(ModuleInstance.Create(peImage, symReader, includeLocalSignatures));
        }
Exemplo n.º 3
0
        internal static RuntimeInstance Create(
            ModuleInstance module,
            IEnumerable <MetadataReference> references)
        {
            // Create modules for the references and the program
            var modules = ImmutableArray.CreateRange(
                references.Select(r => r.ToModuleInstance()).
                Concat(new[] { module }));

            VerifyAllModules(modules);
            return(new RuntimeInstance(modules));
        }
Exemplo n.º 4
0
        internal static RuntimeInstance Create(
            ModuleInstance module,
            IEnumerable<MetadataReference> references)
        {
            // Create modules for the references and the program
            var modules = ImmutableArray.CreateRange(
                references.Select(r => r.ToModuleInstance()).
                Concat(new[] { module }));

            VerifyAllModules(modules);
            return new RuntimeInstance(modules);
        }
 internal static ModuleInstance ToModuleInstance(this MetadataReference reference)
 {
     return(ModuleInstance.Create((PortableExecutableReference)reference));
 }