6 instantiations of ModuleMetadata
Microsoft.CodeAnalysis (6)
MetadataReference\ModuleMetadata.cs (6)
110return new ModuleMetadata(metadata, size, onDispose, includeEmbeddedInteropTypes: false, ignoreAssemblyRefs: false); 117return new ModuleMetadata(metadata, size, onDispose: null, includeEmbeddedInteropTypes, ignoreAssemblyRefs); 142return new ModuleMetadata(new PEReader(peImage, size), onDispose); 172return new ModuleMetadata(new PEReader(peImage), onDispose: null); 251return new ModuleMetadata(new PEReader(peStream, options), onDispose: null); 284return new ModuleMetadata(this);
768 references to ModuleMetadata
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (2)
RazorReferenceManager.cs (2)
77var moduleMetadata = ModuleMetadata.CreateFromStream(stream, PEStreamOptions.PrefetchMetadata);
Microsoft.CodeAnalysis (67)
Compilation\DeterministicKeyBuilder.cs (2)
311case ModuleMetadata m: 344void writeModuleMetadata(ModuleMetadata moduleMetadata)
DiagnosticAnalyzer\AnalyzerFileReference.cs (1)
229foreach (var module in assembly.GetModules())
Emit\EditAndContinue\EmitBaseline.cs (5)
84public static EmitBaseline CreateInitialBaseline(ModuleMetadata module, Func<MethodDefinitionHandle, EditAndContinueMethodDebugInformation> debugInformationProvider) 90ModuleMetadata module, 140ModuleMetadata module, 208public ModuleMetadata OriginalMetadata { get; } 290ModuleMetadata module,
MetadataReader\PEModule.cs (4)
38private readonly ModuleMetadata _owner; 145internal PEModule(ModuleMetadata owner, PEReader peReader, IntPtr metadataOpt, int metadataSizeOpt, bool includeEmbeddedInteropTypes, bool ignoreAssemblyRefs) 273throw new ObjectDisposedException(nameof(ModuleMetadata)); 3998public ModuleMetadata GetNonDisposableMetadata() => _owner.Copy();
MetadataReference\AssemblyMetadata.cs (25)
27public readonly ImmutableArray<ModuleMetadata> Modules; 34public Data(ImmutableArray<ModuleMetadata> modules, PEAssembly assembly) 49/// Factory that provides the <see cref="ModuleMetadata"/> for additional modules (other than <see cref="_initialModules"/>) of the assembly. 53private readonly Func<string, ModuleMetadata>? _moduleFactoryOpt; 58private readonly ImmutableArray<ModuleMetadata> _initialModules; 65private ImmutableArray<ModuleMetadata> _lazyPublishedModules; 90internal AssemblyMetadata(ImmutableArray<ModuleMetadata> modules) 97internal AssemblyMetadata(ModuleMetadata manifestModule, Func<string, ModuleMetadata> moduleFactory) 116return Create(ModuleMetadata.CreateFromImage(peImage)); 129return Create(ModuleMetadata.CreateFromImage(peImage)); 140return Create(ModuleMetadata.CreateFromStream(peStream, leaveOpen)); 151return Create(ModuleMetadata.CreateFromStream(peStream, options)); 164return CreateFromFile(ModuleMetadata.CreateFromFile(path), path); 167internal static AssemblyMetadata CreateFromFile(ModuleMetadata manifestModule, string path) 169return new AssemblyMetadata(manifestModule, moduleName => ModuleMetadata.CreateFromFile(Path.Combine(Path.GetDirectoryName(path) ?? "", moduleName))); 179public static AssemblyMetadata Create(ModuleMetadata module) 198public static AssemblyMetadata Create(ImmutableArray<ModuleMetadata> modules) 230public static AssemblyMetadata Create(IEnumerable<ModuleMetadata> modules) 243public static AssemblyMetadata Create(params ModuleMetadata[] modules) 279public ImmutableArray<ModuleMetadata> GetModules() 317ImmutableArray<ModuleMetadata> modules = _initialModules; 318ImmutableArray<ModuleMetadata>.Builder? moduleBuilder = null; 330moduleBuilder = ImmutableArray.CreateBuilder<ModuleMetadata>(1 + additionalModuleNames.Length); 382foreach (var module in _initialModules)
MetadataReference\MetadataReference.cs (11)
102/// It is recommended to use <see cref="AssemblyMetadata.CreateFromImage(ImmutableArray{byte})"/> or <see cref="ModuleMetadata.CreateFromImage(ImmutableArray{byte})"/> 115/// <see cref="ModuleMetadata.CreateFromImage(ImmutableArray{byte})"/> and <see cref="ModuleMetadata.GetReference(DocumentationProvider, string, string)"/>. 127MetadataImageKind.Module => ModuleMetadata.CreateFromImage(peImage), 144/// It is recommended to use <see cref="AssemblyMetadata.CreateFromImage(IEnumerable{byte})"/> or <see cref="ModuleMetadata.CreateFromImage(IEnumerable{byte})"/> 165MetadataImageKind.Module => ModuleMetadata.CreateFromImage(peImage), 186/// It is recommended to use <see cref="AssemblyMetadata.CreateFromStream(Stream, PEStreamOptions)"/> or <see cref="ModuleMetadata.CreateFromStream(Stream, PEStreamOptions)"/> 208MetadataImageKind.Module => ModuleMetadata.CreateFromStream(peStream, PEStreamOptions.PrefetchEntireImage), 228/// It is recommended to use <see cref="AssemblyMetadata.CreateFromFile(string)"/> or <see cref="ModuleMetadata.CreateFromFile(string)"/> 272var module = ModuleMetadata.CreateFromStream(peStream, options);
MetadataReference\ModuleMetadata.cs (14)
52private ModuleMetadata(ModuleMetadata metadata) 71public static ModuleMetadata CreateFromMetadata(nint metadata, int size) 84public static unsafe ModuleMetadata CreateFromMetadata( 95private static ModuleMetadata CreateFromMetadataWorker( 113internal static ModuleMetadata CreateFromMetadata(IntPtr metadata, int size, bool includeEmbeddedInteropTypes, bool ignoreAssemblyRefs = false) 127public static unsafe ModuleMetadata CreateFromImage(nint peImage, int size) 130private static unsafe ModuleMetadata CreateFromImage(byte* peImage, int size, Action? onDispose) 150public static ModuleMetadata CreateFromImage(IEnumerable<byte> peImage) 165public static ModuleMetadata CreateFromImage(ImmutableArray<byte> peImage) 185public static ModuleMetadata CreateFromStream(Stream peStream, bool leaveOpen = false) 208public static ModuleMetadata CreateFromStream(Stream peStream, PEStreamOptions options) 267public static ModuleMetadata CreateFromFile(string path) 282internal new ModuleMetadata Copy() 322throw new ObjectDisposedException(nameof(ModuleMetadata));
ReferenceManager\CommonReferenceManager.Resolution.cs (3)
371var moduleMetadata = (ModuleMetadata)metadata; 500_ = ((ModuleMetadata)newMetadata).Module.IsLinkedModule;
Symbols\IModuleSymbol.cs (2)
45/// If this symbol represents a metadata module returns the underlying <see cref="ModuleMetadata"/>. 49ModuleMetadata? GetMetadata();
Microsoft.CodeAnalysis.CSharp (8)
Emitter\EditAndContinue\PEDeltaAssemblyBuilder.cs (1)
95var originalMetadata = initialBaseline.OriginalMetadata;
Symbols\Metadata\PE\PEModuleSymbol.cs (1)
789public override ModuleMetadata GetMetadata() => _module.GetNonDisposableMetadata();
Symbols\MissingModuleSymbol.cs (1)
193public override ModuleMetadata GetMetadata() => null;
Symbols\ModuleSymbol.cs (2)
401/// If this symbol represents a metadata module returns the underlying <see cref="ModuleMetadata"/>. 405public abstract ModuleMetadata GetMetadata();
Symbols\PublicModel\ModuleSymbol.cs (1)
47ModuleMetadata IModuleSymbol.GetMetadata() => _underlying.GetMetadata();
Symbols\Retargeting\RetargetingModuleSymbol.cs (1)
310public override ModuleMetadata GetMetadata() => _underlyingModule.GetMetadata();
Symbols\Source\SourceModuleSymbol.cs (1)
689public override ModuleMetadata? GetMetadata() => null;
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (6)
CommandLineTests.cs (6)
4501using (var metadata = ModuleMetadata.CreateFromImage(File.ReadAllBytes(Path.Combine(dir.Path, "aa.exe")))) 7090using (var metadata = ModuleMetadata.CreateFromImage(File.ReadAllBytes(Path.Combine(dir.Path, expectedOutputName)))) 9777Assert.Equal("v4.0.30319", ModuleMetadata.CreateFromImage(comp.EmitToArray(new EmitOptions(runtimeMetadataVersion: "v4.0.30319"))).Module.MetadataVersion); 9780Assert.Equal("_+@%#*^", ModuleMetadata.CreateFromImage(comp.EmitToArray(new EmitOptions(runtimeMetadataVersion: "_+@%#*^"))).Module.MetadataVersion);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (34)
CodeGen\CodeGenTupleTest.cs (4)
22773using (ModuleMetadata block = ModuleMetadata.CreateFromStream(comp.EmitToStream())) 22813using (ModuleMetadata block = ModuleMetadata.CreateFromStream(comp.EmitToStream()))
Emit\CompilationEmitTests.cs (24)
1312var reference = ModuleMetadata.CreateFromImage(moduleComp.EmitToArray()).GetReference(); 1958var id1 = ModuleMetadata.CreateFromImage(firstImage).GetMetadataReader().ReadAssemblyIdentityOrThrow(); 1959var id2 = ModuleMetadata.CreateFromImage(secondImage).GetMetadataReader().ReadAssemblyIdentityOrThrow(); 3469var metadataReader = ModuleMetadata.CreateFromStream(compilation.EmitToStream()).MetadataReader; 4025using (ModuleMetadata metadata = ModuleMetadata.CreateFromImage(stream.ToImmutable())) 4061using (ModuleMetadata metadata = ModuleMetadata.CreateFromImage(stream.ToImmutable())) 4091using (ModuleMetadata metadata = ModuleMetadata.CreateFromImage(stream.ToImmutable())) 4122using (ModuleMetadata metadata = ModuleMetadata.CreateFromImage(stream.ToImmutable())) 4153using (ModuleMetadata metadata = ModuleMetadata.CreateFromImage(stream.ToImmutable())) 4184using (ModuleMetadata metadata = ModuleMetadata.CreateFromImage(stream.ToImmutable())) 4213using (ModuleMetadata block = ModuleMetadata.CreateFromStream(compilation.EmitToStream())) 4621var metadataRef = ModuleMetadata.CreateFromStream(comp.EmitToStream()).GetReference(); 5070var peReader = ModuleMetadata.CreateFromStream(compilation.EmitToStream()).Module.GetMetadataReader(); 5356using (var metadata = ModuleMetadata.CreateFromImage(bytes)) 5418using (var metadata = ModuleMetadata.CreateFromImage(bytes))
Emit\DeterministicTests.cs (2)
345using (var block = ModuleMetadata.CreateFromStream(stream))
Emit\EmitErrorTests.cs (2)
266var moduleMetadata = ModuleMetadata.CreateFromImage(netModule.EmitToArray());
Emit\EmitMetadataTests.cs (2)
236var netModule1 = ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.netModule.netModule1).GetReference(filePath: Path.GetFullPath("netModule1.netmodule")); 237var netModule2 = ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.netModule.netModule2).GetReference(filePath: Path.GetFullPath("netModule2.netmodule"));
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (190)
Emit\EditAndContinue\AssemblyReferencesTests.cs (10)
223var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 328var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 411var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 491var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 591var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData);
Emit\EditAndContinue\EditAndContinueClosureTests.cs (88)
249var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 310var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 382var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 440var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 492var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 552var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 606var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 661var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 717var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 772var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 840var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 915var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 989var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 1056var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 1115var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 1203var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 1292var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 1376var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 1467var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 1549var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 1626var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 1725var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 1816var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 1924var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 2122var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 2333var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 2471var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 2588var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 2726var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 2794var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 2864var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 2970var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 3090var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 3186var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 3247var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 3486var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 3731var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 3852var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 3932var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 4125var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 4210var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 4292var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 4365var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 4447var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData);
Emit\EditAndContinue\EditAndContinueDelegateCacheTests.cs (10)
54using var moduleData0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 118using var moduleData0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 182using var moduleData0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 246using var moduleData0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 310using var moduleData0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData);
Emit\EditAndContinue\EditAndContinuePdbTests.cs (2)
130var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData);
Emit\EditAndContinue\EditAndContinueStateMachineTests.cs (12)
54using var md0 = ModuleMetadata.CreateFromImage(bytes0); 235using var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 351using var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 453using var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 526using (var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData)) 577using var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData);
Emit\EditAndContinue\EditAndContinueTestBase.cs (2)
37internal static string Visualize(ModuleMetadata baseline, params PinnedMetadata[] deltas) 44public static EmitBaseline CreateInitialBaseline(Compilation compilation, ModuleMetadata module, Func<MethodDefinitionHandle, EditAndContinueMethodDebugInformation> debugInformationProvider)
Emit\EditAndContinue\EditAndContinueTests.cs (16)
273using var md0 = ModuleMetadata.CreateFromImage(compilation0.EmitToArray()); 315using var md0 = ModuleMetadata.CreateFromImage(bytes0); 348var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 401var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 469var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 507using var md0 = ModuleMetadata.CreateFromImage(bytes0); 569using var md0 = ModuleMetadata.CreateFromImage(bytes0); 798using var md0 = ModuleMetadata.CreateFromImage(bytes0);
Emit\EditAndContinue\LocalSlotMappingTests.cs (46)
55var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData), methodData0.EncDebugInfoProvider()); 249var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), symReader.GetEncMethodDebugInfo); 433var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), m => methodData0.GetEncDebugInfo()); 536using var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 648using var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 758using var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 849using var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 1154var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), methodData0.EncDebugInfoProvider()); 1216ModuleMetadata.CreateFromImage(bytes0), 1324ModuleMetadata.CreateFromImage(bytes0), 1488ModuleMetadata.CreateFromImage(bytes0), 1745var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData), methodData0.EncDebugInfoProvider()); 1856ModuleMetadata.CreateFromImage(bytes0), 2016ModuleMetadata.CreateFromImage(bytes0), 2049ModuleMetadata.CreateFromImage(bytes0), 2199var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData), methodData0.EncDebugInfoProvider()); 2423var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData), methodData0.EncDebugInfoProvider()); 2606ModuleMetadata.CreateFromImage(bytes0), 2744ModuleMetadata.CreateFromImage(bytes0), 2921var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData), methodData0.EncDebugInfoProvider()); 3057var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData), methodData0.EncDebugInfoProvider()); 3220var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData), methodData0.EncDebugInfoProvider()); 3384var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData), methodData0.EncDebugInfoProvider()); 3493var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData), methodData0.EncDebugInfoProvider()); 3603var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData), methodData0.EncDebugInfoProvider()); 3694var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData), methodData0.EncDebugInfoProvider()); 3897var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); 4240var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), methodData0.EncDebugInfoProvider()); 4287var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), methodData0.EncDebugInfoProvider()); 4343var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), methodData0.EncDebugInfoProvider()); 4398var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), methodData0.EncDebugInfoProvider()); 4450var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), methodData0.EncDebugInfoProvider()); 4506var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), methodData0.EncDebugInfoProvider()); 4575var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), methodData0.EncDebugInfoProvider()); 4655var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), methodData0.EncDebugInfoProvider()); 4750var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), methodData0.EncDebugInfoProvider()); 4809var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), methodData0.EncDebugInfoProvider()); 4869var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), methodData0.EncDebugInfoProvider()); 4958var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), methodData0.EncDebugInfoProvider()); 5112var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData);
Emit\LocalStateTracing\LocalStateTracingTests.cs (2)
437using var md0 = ModuleMetadata.CreateFromImage(compilation0.EmitToArray());
PDB\TypeDefinitionDocumentTests.cs (2)
470var metadata = ModuleMetadata.CreateFromImage(pe);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (30)
Attributes\AttributeTests_Assembly.cs (11)
944using (var metadata = ModuleMetadata.CreateFromStream(stream)) 1010private ModuleMetadata GetNetModuleWithAssemblyAttributes(string source = null, IEnumerable<MetadataReference> references = null, string assemblyName = null) 1014return ModuleMetadata.CreateFromImage(netmoduleCompilation.EmitToArray()); 1061var netModuleWithAssemblyAttributes = GetNetModuleWithAssemblyAttributes(); 1128var modMetadata = ModuleMetadata.CreateFromImage(consoleappCompilation.EmitToArray()); 1182var netModuleWithAssemblyAttributes = ModuleMetadata.CreateFromImage(netmoduleCompilation.EmitToArray()); 1243var modMetadata = ModuleMetadata.CreateFromImage(consoleappCompilation.EmitToArray());
Attributes\AttributeTests_Embedded.cs (2)
107var reference = ModuleMetadata.CreateFromImage(module.EmitToArray()).GetReference(); 227var moduleRef = ModuleMetadata.CreateFromImage(module.EmitToArray()).GetReference();
Attributes\AttributeTests_StructLayout.cs (2)
612using (var module = ModuleMetadata.CreateFromImage(TestResources.MetadataTests.Invalid.ClassLayout))
Attributes\AttributeTests_Synthesized.cs (3)
1521var reference = ModuleMetadata.CreateFromImage(referenceComp.EmitToArray()).GetReference(); 1562var reference = ModuleMetadata.CreateFromImage(referenceComp.EmitToArray()).GetReference(); 1623var moduleReference = ModuleMetadata.CreateFromImage(compilation.EmitToArray()).GetReference();
Attributes\AttributeTests_WellKnownAttributes.cs (4)
3144using (var metadata = ModuleMetadata.CreateFromStream(image)) 10696var metadata = ModuleMetadata.CreateFromStream(comp.EmitToStream());
Attributes\InternalsVisibleToAndStrongNameTests.cs (8)
481var metadata = ModuleMetadata.CreateFromImage(c.EmitToArray()); 510var metadata = ModuleMetadata.CreateFromImage(c.EmitToArray()); 1533using (var metadata = ModuleMetadata.CreateFromStream(moduleContents)) 1982using (var metadata = ModuleMetadata.CreateFromImage(other.EmitToArray()))
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (24)
Compilation\CompilationAPITests.cs (2)
2235using (var mdModule = ModuleMetadata.CreateFromMetadata((IntPtr)ptr, h.MetadataSize))
Symbols\Metadata\PE\TypeForwarders.cs (12)
1507using (ModuleMetadata metadata = ModuleMetadata.CreateFromImage(verifier2.EmittedAssemblyData)) 1545var ref0 = ModuleMetadata.CreateFromImage(bits0).GetReference(); 1549var ref1 = AssemblyMetadata.Create(ModuleMetadata.CreateFromImage(bits1), ModuleMetadata.CreateFromImage(bits0)).GetReference(); 1707var appModule = ModuleMetadata.CreateFromImage(appCompilation.EmitToArray()).Module; 1728var asm0 = ModuleMetadata.CreateFromImage(CompileAndVerify(comp0, verify: Verification.Skipped).EmittedAssemblyData); 1732var asm1 = ModuleMetadata.CreateFromImage(CompileAndVerify(comp1).EmittedAssemblyData); 1776using (ModuleMetadata metadata = ModuleMetadata.CreateFromImage(verifier2.EmittedAssemblyData))
Symbols\SymbolErrorTests.cs (9)
25private static readonly ModuleMetadata s_mod1 = ModuleMetadata.CreateFromImage(TestResources.DiagnosticTests.ErrTestMod01); 26private static readonly ModuleMetadata s_mod2 = ModuleMetadata.CreateFromImage(TestResources.DiagnosticTests.ErrTestMod02); 104references: new[] { ModuleMetadata.CreateFromImage(module1.EmitToArray(options: new EmitOptions(metadataOnly: true))).GetReference() }); 109references: new[] { ModuleMetadata.CreateFromImage(module2.EmitToArray(options: new EmitOptions(metadataOnly: true))).GetReference() }); 7134var moduleRef = ModuleMetadata.CreateFromImage(ilBytes).GetReference(); 7203var moduleRef1 = ModuleMetadata.CreateFromImage(ilBytes).GetReference(); 15174var ref1 = ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.CorLibrary.NoMsCorLibRef).GetReference(display: "NoMsCorLibRef.mod");
Symbols\TypeTests.cs (1)
894var module1Ref = ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.netModule.netModule1).GetReference(display: "netModule1.netmodule");
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (19)
MetadataUtilities.cs (19)
37var metadataBuilder = ArrayBuilder<ModuleMetadata>.GetInstance(); 45var runtimeWinMdBuilder = ArrayBuilder<ModuleMetadata>.GetInstance(); 49var metadata = ModuleMetadata.CreateFromMetadata(block.Pointer, block.Size, includeEmbeddedInteropTypes: true); 70metadata = ModuleMetadata.CreateFromMetadata(block.Pointer, block.Size, includeEmbeddedInteropTypes: true, ignoreAssemblyRefs: true); 95Dictionary<string, ModuleMetadata?>? modulesByName = null; 104modulesByName ??= new Dictionary<string, ModuleMetadata?>(); // Requires case-insensitive comparison? 174ModuleMetadata? targetModule = null; 327private static PortableExecutableReference MakeAssemblyReference(ModuleMetadata metadata, Dictionary<string, ModuleMetadata?>? modulesByName) 331var builder = ArrayBuilder<ModuleMetadata>.GetInstance(); 351if (!modulesByName.TryGetValue(name, out var module)) 407private static PortableExecutableReference MakeCompileTimeWinMdAssemblyMetadata(ArrayBuilder<ModuleMetadata> runtimeModules) 409var metadata = ModuleMetadata.CreateFromImage(GetWindowsProxyBytes()); 410var builder = ArrayBuilder<ModuleMetadata>.GetInstance(); 417private static bool IsPrimaryModule(ModuleMetadata metadata) 479using (var metadata = ModuleMetadata.CreateFromStream(new MemoryStream(assembly)))
Microsoft.CodeAnalysis.Features (2)
EditAndContinue\DebuggingSession.cs (2)
365var moduleMetadata = ModuleMetadata.CreateFromMetadata((IntPtr)metadataReader.MetadataPointer, metadataReader.MetadataLength);
Microsoft.CodeAnalysis.Features.Test.Utilities (2)
EditAndContinue\EditAndContinueWorkspaceTestBase.cs (2)
307var moduleMetadata = ModuleMetadata.CreateFromImage(peImage);
Microsoft.CodeAnalysis.Scripting (6)
Hosting\AssemblyLoader\MetadataShadowCopyProvider.cs (6)
255newMetadata = ModuleMetadata.CreateFromFile(fullPath); 452ImmutableArray<ModuleMetadata>.Builder moduleBuilder = null; 455ModuleMetadata manifestModule = null; 465moduleBuilder = ImmutableArray.CreateBuilder<ModuleMetadata>(); 500private static ModuleMetadata CreateModuleMetadata(FileStream stream) 504return ModuleMetadata.CreateFromStream(stream, leaveOpen: false);
Microsoft.CodeAnalysis.Scripting.UnitTests (3)
ScriptOptionsTests.cs (3)
38var moduleRef = ModuleMetadata.CreateFromImage(TestResources.MetadataTests.NetModule01.ModuleCS00).GetReference(); 71var assemblyRef = ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.Methods.CSMethods).GetReference(); 80var moduleRef = ModuleMetadata.CreateFromImage(TestResources.MetadataTests.NetModule01.ModuleCS00).GetReference();
Microsoft.CodeAnalysis.Test.Utilities (52)
CommonTestBase.cs (2)
168: ((ModuleMetadata)emittedMetadata).GetReference(); 253return ModuleMetadata.CreateFromImage(assemblyBytes).GetReference();
Compilation\CompilationExtensions.cs (1)
132return ModuleMetadata.CreateFromImage(image).GetReference(display: comp.MakeSourceModuleName());
Compilation\IRuntimeEnvironment.cs (3)
85private static IEnumerable<ModuleMetadata> EnumerateModules(Metadata metadata) 87return (metadata.Kind == MetadataImageKind.Assembly) ? ((AssemblyMetadata)metadata).GetModules().AsEnumerable() : SpecializedCollections.SingletonEnumerable((ModuleMetadata)metadata); 118foreach (var module in EnumerateModules(metadata))
Compilation\MetadataReferenceExtensions.cs (3)
23public static ModuleMetadata GetManifestModuleMetadata(this MetadataReference reference) 28public static ModuleMetadata GetManifestModuleMetadata(this PortableExecutableReference peReference) 40case ModuleMetadata moduleMetadata:
CompilationVerifier.cs (10)
68var metadata = ModuleMetadata.CreateFromImage(EmittedAssemblyData); 86var metadata = ModuleMetadata.CreateFromImage(image); 170using var moduleMetadata = ModuleMetadata.CreateFromImage(testEnvironment.GetMainImage()); 233using (var moduleMetadata = ModuleMetadata.CreateFromImage(testEnvironment.GetMainImage())) 713var moduleMetadata = ModuleMetadata.CreateFromImage(image);
ICompilationVerifier.cs (1)
13ImmutableArray<ModuleMetadata> GetAllModuleMetadata();
Metadata\ILValidation.cs (2)
47using (var metadata = ModuleMetadata.CreateFromStream(moduleContents, leaveOpen: true))
Metadata\ModuleData.cs (2)
97using (var metadata = ModuleMetadata.CreateFromImage(image))
Mocks\TestReferences.cs (28)
27() => ModuleMetadata.CreateFromImage(TestResources.MetadataTests.NetModule01.ModuleCS00).GetReference(display: "ModuleCS00.mod"), 32() => ModuleMetadata.CreateFromImage(TestResources.MetadataTests.NetModule01.ModuleCS01).GetReference(display: "ModuleCS01.mod"), 37() => ModuleMetadata.CreateFromImage(TestResources.MetadataTests.NetModule01.ModuleVB01).GetReference(display: "ModuleVB01.mod"), 182() => ModuleMetadata.CreateFromImage(TestResources.General.With_SpacesModule).GetReference(display: "With Spaces.netmodule"), 219() => ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.netModule.netModule1).GetReference(display: "netModule1.netmodule"), 224() => ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.netModule.netModule2).GetReference(display: "netModule2.netmodule"), 229() => ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.netModule.CrossRefModule1).GetReference(display: "CrossRefModule1.netmodule"), 234() => ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.netModule.CrossRefModule2).GetReference(display: "CrossRefModule2.netmodule"), 240ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.netModule.CrossRefLib), 241ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.netModule.CrossRefModule1), 242ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.netModule.CrossRefModule2)).GetReference(display: "CrossRefLib.dll"), 247() => ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.netModule.hash_module).GetReference(display: "hash_module.netmodule"), 252() => ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.netModule.x64COFF).GetReference(display: "x64COFF.obj"), 270() => ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.V1.MTTestModule1).GetReference(display: "MTTestModule1.netmodule"), 286() => ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.V1.MTTestModule2).GetReference(display: "MTTestModule2.netmodule"), 321() => ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.V2.MTTestModule3).GetReference(display: "MTTestModule3.netmodule"), 356() => ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.V3.MTTestModule4).GetReference(display: "MTTestModule4.netmodule"), 366ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.MultiModule.MultiModuleDll), 367ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.MultiModule.mod2), 368ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.MultiModule.mod3)).GetReference(display: "MultiModule.dll"), 445() => ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.CustomModifiers.ModifiersModule).GetReference(display: "Modifiers.netmodule"), 529() => ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.RetargetingCycle.RetV1.ClassB).GetReference(display: "ClassB.netmodule"), 665() => ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.MultiTargeting.Source1Module).GetReference(display: "Source1Module.netmodule"), 670() => ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.MultiTargeting.Source3Module).GetReference(display: "Source3Module.netmodule"), 675() => ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.MultiTargeting.Source4Module).GetReference(display: "Source4Module.netmodule"), 680() => ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.MultiTargeting.Source5Module).GetReference(display: "Source5Module.netmodule"), 685() => ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.MultiTargeting.Source7Module).GetReference(display: "Source7Module.netmodule"), 828() => ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.netModule.netModule1).GetReference(display: "netModule1.netmodule"),
Microsoft.CodeAnalysis.UnitTests (84)
Emit\EmitBaselineTests.cs (4)
24var peModule = ModuleMetadata.CreateFromImage(TestResources.Basic.Members); 31var mdModule = ModuleMetadata.CreateFromMetadata((IntPtr)mdBytesPointer, mdBytes.Length);
MetadataReferences\AssemblyMetadataTests.cs (20)
28Assert.Throws<ArgumentNullException>(() => AssemblyMetadata.Create((ModuleMetadata)null)); 29Assert.Throws<ArgumentException>(() => AssemblyMetadata.Create(default(ImmutableArray<ModuleMetadata>))); 30Assert.Throws<ArgumentException>(() => AssemblyMetadata.Create(ImmutableArray.Create<ModuleMetadata>())); 32var m1 = ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.MultiModule.MultiModuleDll); 33var m2 = ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.MultiModule.mod2); 34var m3 = ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.MultiModule.mod3); 37Assert.Throws<ArgumentException>(() => AssemblyMetadata.Create(new List<ModuleMetadata>(new ModuleMetadata[] { m1.Copy(), m2.Copy(), m3.Copy() }))); 39Assert.Throws<ArgumentNullException>(() => AssemblyMetadata.Create(ImmutableArray.Create((ModuleMetadata)null))); 75ModuleMetadata m1, m2, m3; 77m1 = ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.MultiModule.MultiModuleDll), 78m2 = ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.MultiModule.mod2), 79m3 = ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.MultiModule.mod3)); 91ModuleMetadata m1, m2, m3; 93m1 = ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.MultiModule.MultiModuleDll), 94m2 = ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.MultiModule.mod2), 95m3 = ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.MultiModule.mod3));
MetadataReferences\MetadataReferenceTests.cs (10)
84Assert.IsAssignableFrom<ModuleMetadata>(r.GetMetadata()); 149Assert.IsAssignableFrom<ModuleMetadata>(r.GetMetadata()); 188Assert.IsAssignableFrom<ModuleMetadata>(r.GetMetadata()); 200var metadata = (ModuleMetadata)r.GetMetadataNoCopy(); 256var module = ModuleMetadata.CreateFromImage(TestResources.General.C1); 401var module = ModuleMetadata.CreateFromImage(TestResources.General.C1); 436r = ModuleMetadata.CreateFromImage(TestResources.General.C1).GetReference();
MetadataReferences\ModuleMetadataTests.cs (50)
23Assert.Throws<ArgumentNullException>(() => ModuleMetadata.CreateFromMetadata(IntPtr.Zero, 0)); 24Assert.Throws<ArgumentOutOfRangeException>(() => { fixed (byte* ptr = new byte[] { 1, 2, 3 }) ModuleMetadata.CreateFromMetadata((IntPtr)ptr, 0); }); 25Assert.Throws<ArgumentOutOfRangeException>(() => { fixed (byte* ptr = new byte[] { 1, 2, 3 }) ModuleMetadata.CreateFromMetadata((IntPtr)ptr, -1); }); 29var metadata = ModuleMetadata.CreateFromMetadata((IntPtr)ptr, 3); 42var metadata = ModuleMetadata.CreateFromMetadata((IntPtr)ptr, h.MetadataSize); 55ModuleMetadata.CreateFromMetadata((IntPtr)ptr, h.MetadataSize); 68var metadata = ModuleMetadata.CreateFromMetadata((IntPtr)stream.PositionPointer, (int)stream.Length, stream.Dispose); 82ModuleMetadata.CreateFromMetadata((IntPtr)stream.PositionPointer, (int)stream.Length, stream.Dispose); 89Assert.Throws<ArgumentNullException>(() => ModuleMetadata.CreateFromImage(IntPtr.Zero, 0)); 90Assert.Throws<ArgumentOutOfRangeException>(() => { fixed (byte* ptr = new byte[] { 1, 2, 3 }) ModuleMetadata.CreateFromImage((IntPtr)ptr, 0); }); 91Assert.Throws<ArgumentOutOfRangeException>(() => { fixed (byte* ptr = new byte[] { 1, 2, 3 }) ModuleMetadata.CreateFromImage((IntPtr)ptr, -1); }); 93Assert.Throws<ArgumentNullException>(() => ModuleMetadata.CreateFromImage(default(ImmutableArray<byte>))); 96Assert.Throws<ArgumentNullException>(() => ModuleMetadata.CreateFromImage(enumerableImage)); 99Assert.Throws<ArgumentNullException>(() => ModuleMetadata.CreateFromImage(arrayImage)); 103ModuleMetadata.CreateFromImage(TestResources.MetadataTests.Invalid.EmptyModuleTable); 109Assert.Throws<ArgumentNullException>(() => ModuleMetadata.CreateFromStream(peStream: null)); 110Assert.Throws<ArgumentException>(() => ModuleMetadata.CreateFromStream(new TestStream(canRead: false, canSeek: true))); 111Assert.Throws<ArgumentException>(() => ModuleMetadata.CreateFromStream(new TestStream(canRead: true, canSeek: false))); 117Assert.Throws<ArgumentNullException>(() => ModuleMetadata.CreateFromFile((string)null)); 118Assert.Throws<ArgumentException>(() => ModuleMetadata.CreateFromFile("")); 119Assert.Throws<ArgumentException>(() => ModuleMetadata.CreateFromFile(@"c:\*")); 122Assert.Throws<IOException>(() => ModuleMetadata.CreateFromFile(@"http://goo.bar")); 123Assert.Throws<FileNotFoundException>(() => ModuleMetadata.CreateFromFile(systemDrive + @":\file_that_does_not_exists.dll")); 124Assert.Throws<FileNotFoundException>(() => ModuleMetadata.CreateFromFile(systemDrive + @":\directory_that_does_not_exists\file_that_does_not_exists.dll")); 125Assert.Throws<PathTooLongException>(() => ModuleMetadata.CreateFromFile(systemDrive + @":\" + new string('x', 1000))); 126Assert.Throws<IOException>(() => ModuleMetadata.CreateFromFile(Environment.GetFolderPath(Environment.SpecialFolder.Windows))); 132var md = ModuleMetadata.CreateFromImage(Net461.Resources.mscorlib); 141var m = ModuleMetadata.CreateFromImage(Net461.Resources.mscorlib); 170ModuleMetadata.CreateFromStream(new MemoryStream(), PEStreamOptions.Default); 171Assert.Throws<BadImageFormatException>(() => ModuleMetadata.CreateFromStream(new MemoryStream(), PEStreamOptions.PrefetchMetadata)); 172Assert.Throws<BadImageFormatException>(() => ModuleMetadata.CreateFromStream(new MemoryStream(), PEStreamOptions.PrefetchMetadata | PEStreamOptions.PrefetchEntireImage)); 189var metadata = ModuleMetadata.CreateFromStream(stream, leaveOpen: false); 218var metadata = ModuleMetadata.CreateFromMetadata((IntPtr)stream.PositionPointer, (int)stream.Length, stream.Dispose); 244var metadata = ModuleMetadata.CreateFromStream(stream, leaveOpen: true); 276var metadata = ModuleMetadata.CreateFromMetadata((IntPtr)stream.PositionPointer, (int)stream.Length); 308var metadata = ModuleMetadata.CreateFromStream(stream, options); 339var metadata = ModuleMetadata.CreateFromStream(stream, options | PEStreamOptions.LeaveOpen); 375var metadata = ModuleMetadata.CreateFromStream(stream, leaveOpen: false);
Microsoft.CodeAnalysis.VisualBasic (6)
Symbols\Metadata\PE\PEModuleSymbol.vb (1)
494Public Overrides Function GetMetadata() As ModuleMetadata
Symbols\MissingModuleSymbol.vb (1)
171Public Overrides Function GetMetadata() As ModuleMetadata
Symbols\ModuleSymbol.vb (2)
130''' If this symbol represents a metadata module returns the underlying <see cref="ModuleMetadata"/>. 134Public MustOverride Function GetMetadata() As ModuleMetadata Implements IModuleSymbol.GetMetadata
Symbols\Retargeting\RetargetingModuleSymbol.vb (1)
290Public Overrides Function GetMetadata() As ModuleMetadata
Symbols\Source\SourceModuleSymbol.vb (1)
1195Public Overrides Function GetMetadata() As ModuleMetadata
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (168)
Attributes\AssemblyAttributes.vb (6)
1152Using mt = ModuleMetadata.CreateFromImage(stream.ToImmutable()) 1225Optional nameSuffix As String = "") As ModuleMetadata 1230Return ModuleMetadata.CreateFromImage(bytes) 1348metadata = ModuleMetadata.CreateFromImage(consoleappCompilation.EmitToArray()).Module 1410Dim netModuleWithAssemblyAttributes = ModuleMetadata.CreateFromImage(bytes) 1459metadata = ModuleMetadata.CreateFromImage(consoleappCompilation.EmitToArray()).Module
Attributes\AttributeTests.vb (1)
4969Dim reference = ModuleMetadata.CreateFromImage(moduleCode.EmitToArray()).GetReference()
Attributes\AttributeTests_StructLayout.vb (1)
727Using [module] = ModuleMetadata.CreateFromImage(TestResources.MetadataTests.Invalid.ClassLayout)
Attributes\AttributeTests_WellKnownAttributes.vb (1)
2123Dim peReader = ModuleMetadata.CreateFromImage(image).Module.GetMetadataReader()
Attributes\InternalsVisibleToAndStrongNameTests.vb (3)
389Dim Metadata = ModuleMetadata.CreateFromImage(c.EmitToArray()) 422Dim Metadata = ModuleMetadata.CreateFromImage(c.EmitToArray()) 1415Using metadata = ModuleMetadata.CreateFromStream(moduleContents)
Emit\CompilationEmitTests.vb (9)
1160Dim reference = ModuleMetadata.CreateFromImage(moduleComp.EmitToArray()).GetReference() 2061Dim metadata = ModuleMetadata.CreateFromImage(compilation.EmitToArray()) 3391Using metadata = ModuleMetadata.CreateFromImage(stream.ToImmutable()) 3427Using metadata = ModuleMetadata.CreateFromImage(stream.ToImmutable()) 3464Using metadata = ModuleMetadata.CreateFromImage(stream.ToImmutable()) 3501Using metadata = ModuleMetadata.CreateFromImage(stream.ToImmutable()) 3538Using metadata = ModuleMetadata.CreateFromImage(stream.ToImmutable()) 4316Dim metadataReader = ModuleMetadata.CreateFromImage(compilation.EmitToArray()).Module.GetMetadataReader() 4424Using metadata = ModuleMetadata.CreateFromImage(bytes)
Emit\DeterministicTests.vb (1)
230Using block = ModuleMetadata.CreateFromStream(stream)
Emit\EditAndContinue\AssemblyReferencesTests.vb (5)
76Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 182Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 267Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 338Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 453Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData)
Emit\EditAndContinue\EditAndContinueClosureTests.vb (24)
50Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), EmptyLocalsProvider) 103Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 154Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 206Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 259Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 338Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 422Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 529Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 625Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 694Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 767Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 831Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 897Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 978Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 1092Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 1336Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 1466Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 1548Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 1663Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 1763Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 1819Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 1981Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 2099Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 2177Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData)
Emit\EditAndContinue\EditAndContinuePdbTests.vb (1)
134Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData)
Emit\EditAndContinue\EditAndContinueStateMachineTests.vb (43)
58Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), EmptyLocalsProvider) 412Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), EmptyLocalsProvider) 735Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 843Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 922Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 970Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 1533Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 1983Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 2569Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 3035Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 3205Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 3592Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 3697Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 3807Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 3913Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 4046Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 4215Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 4476Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 4634Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 4968Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 5476Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 5915Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 6370Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 6523Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 6681Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 6835Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 7094Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 7594Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 8063Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 8198Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 8273Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 8391Using md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 8498Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 8630Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 8765Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 8867Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 8926Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 8981Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 9044Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 9096Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 9135Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 9174Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 9215Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData)
Emit\EditAndContinue\EditAndContinueTestBase.vb (2)
32Friend Shared Function Visualize(baseline As ModuleMetadata, ParamArray deltas As PinnedMetadata()) As String 39Public Shared Function CreateInitialBaseline(compilation As Compilation, [module] As ModuleMetadata, debugInformationProvider As Func(Of MethodDefinitionHandle, EditAndContinueMethodDebugInformation)) As EmitBaseline
Emit\EditAndContinue\EditAndContinueTests.vb (63)
95Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 150Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 187Using md0 = ModuleMetadata.CreateFromImage(bytes0) 247Using md0 = ModuleMetadata.CreateFromImage(bytes0) 349Using md0 = ModuleMetadata.CreateFromImage(bytes0) 355Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), EmptyLocalsProvider) 434Using md0 = ModuleMetadata.CreateFromImage(bytes0) 439Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), EmptyLocalsProvider) 566Using md0 = ModuleMetadata.CreateFromImage(bytes0) 571Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), EmptyLocalsProvider) 621Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes), EmptyLocalsProvider) 764Using md0 = ModuleMetadata.CreateFromImage(bytes0) 831Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 1064Using md0 = ModuleMetadata.CreateFromImage(compilation0.EmitToArray()) 1147Using md0 = ModuleMetadata.CreateFromImage(bytes0) 1243Using md0 = ModuleMetadata.CreateFromImage(bytes0) 1326Using md0 = ModuleMetadata.CreateFromImage(bytes0) 1799Dim md0 = ModuleMetadata.CreateFromImage(bytes0) 1931Dim md0 = ModuleMetadata.CreateFromImage(bytes0) 2074Using md0 = ModuleMetadata.CreateFromImage(bytes0) 2163Using md0 = ModuleMetadata.CreateFromImage(bytes0) 2170Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), EmptyLocalsProvider) 2226Using md0 = ModuleMetadata.CreateFromImage(bytes0) 2230Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), testData0.GetMethodData("Module1.get_P").EncDebugInfoProvider) 2761Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), testData0.GetMethodData("C.M").EncDebugInfoProvider) 2916ModuleMetadata.CreateFromImage(bytes0), 3127Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), EmptyLocalsProvider) 3213Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), testData0.GetMethodData("C.Main").EncDebugInfoProvider) 3285Dim modMeta = ModuleMetadata.CreateFromImage(bytes0) 3372Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), testData0.GetMethodData("C.M").EncDebugInfoProvider) 3466Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), testData0.GetMethodData("C.M").EncDebugInfoProvider) 3551Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), testData0.GetMethodData("C.M").EncDebugInfoProvider) 3686Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), testData0.GetMethodData("C.M").EncDebugInfoProvider) 3867Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), testData0.GetMethodData("C.M").EncDebugInfoProvider) 4046Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), testData0.GetMethodData("C.M").EncDebugInfoProvider) 4242Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), testData0.GetMethodData("C.M").EncDebugInfoProvider) 4397Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), testData0.GetMethodData("C.M").EncDebugInfoProvider) 4498Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), testData0.GetMethodData("C.M").EncDebugInfoProvider) 4599Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), testData0.GetMethodData("C.M").EncDebugInfoProvider) 4780Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 4867Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 4962Using md0 = ModuleMetadata.CreateFromImage(bytes0) 4963Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), 5085Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 5260Using md0 = ModuleMetadata.CreateFromImage(bytes0) 5262ModuleMetadata.CreateFromImage(bytes0), 5333Using md0 = ModuleMetadata.CreateFromImage(bytes0) 5334Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), 5417Using md0 = ModuleMetadata.CreateFromImage(bytes0) 5418Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), 5515Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 5655Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 5854Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), EmptyLocalsProvider) 5890Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), EmptyLocalsProvider) 6665Using md0 = ModuleMetadata.CreateFromImage(bytes0) 6706Using md0 = ModuleMetadata.CreateFromImage(bytes0) 6711Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), EmptyLocalsProvider) 6772Dim mdA0 = ModuleMetadata.CreateFromImage(bytesA0) 6773Dim mdB0 = ModuleMetadata.CreateFromImage(bytesB0) 6838Dim mdB0 = ModuleMetadata.CreateFromImage(bytesB0) 6919Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 7062Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) 7209Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData)
Emit\EditAndContinue\LocalSlotMappingTests.vb (3)
116Dim generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), Function(handle) symReader.GetEncMethodDebugInfo(handle)) 281ModuleMetadata.CreateFromImage(bytes0), 990Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData)
Emit\EmitErrorTests.vb (1)
527Dim netModuleMetadata = ModuleMetadata.CreateFromImage(netModule.EmitToArray())
Emit\EmitMetadata.vb (3)
293Dim netModule1 = ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.netModule.netModule1) 294Dim netModule2 = ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.netModule.netModule2) 313Using metadata = AssemblyMetadata.Create(ModuleMetadata.CreateFromImage(manifestModule), netModule1, netModule2)
PDB\TypeDefinitionDocumentTests.vb (1)
352Dim metadata = ModuleMetadata.CreateFromImage(pe)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (7)
Compilation\CompilationAPITests.vb (4)
1086Dim modRef1 = ModuleMetadata.CreateFromImage(TestResources.MetadataTests.NetModule01.ModuleCS00).GetReference() 1172Dim comp = VisualBasicCompilation.Create("Compilation", references:={ModuleMetadata.CreateFromImage(Net461.Resources.System).GetReference()}) 1184Dim modRef1 = ModuleMetadata.CreateFromImage(TestResources.MetadataTests.NetModule01.ModuleVB01).GetReference() 2475Using mdModule = ModuleMetadata.CreateFromMetadata(pinnedPEImage.AddrOfPinnedObject() + headers.MetadataStartOffset, headers.MetadataSize)
Semantics\FieldInitializerBindingTests.vb (3)
896Using md = ModuleMetadata.CreateFromImage(bytes) 964Using md = ModuleMetadata.CreateFromImage(bytes) 1298Using md = ModuleMetadata.CreateFromImage(bytes)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (15)
SymbolsTests\ExtensionMethods\ExtensionMethodTests.vb (2)
1006Dim ILRef = ModuleMetadata.CreateFromImage(File.ReadAllBytes(reference.Path)).GetReference() 2234Dim ILRef = ModuleMetadata.CreateFromImage(File.ReadAllBytes(reference.Path)).GetReference()
SymbolsTests\Metadata\PE\TypeForwarders.vb (6)
1021Using metadata = ModuleMetadata.CreateFromImage(verifier.EmittedAssemblyData) 1108Dim modRef1 = ModuleMetadata.CreateFromImage(ilBytes).GetReference() 1170Dim modRef2 = ModuleMetadata.CreateFromImage(ilBytes).GetReference() 1196Dim appModule = ModuleMetadata.CreateFromImage(appCompilation.EmitToArray()).Module 1289Dim modRef = ModuleMetadata.CreateFromImage(ilBytes).GetReference() 1350</compilation>, {ModuleMetadata.CreateFromImage(TestResources.SymbolsTests.TypeForwarders.Forwarded).GetReference(),
SymbolsTests\MetadataFileReferenceCompilationTests.vb (1)
38Dim ref = ModuleMetadata.CreateFromImage({}).GetReference(filePath:="Goo.dll")
SymbolsTests\Source\TypeTests.vb (6)
3159Dim moduleRef = ModuleMetadata.CreateFromImage(ilBytes).GetReference() 3225Dim moduleRef1 = ModuleMetadata.CreateFromImage(ilBytes).GetReference() 3332Dim module1_FT1_Ref = ModuleMetadata.CreateFromImage(ilBytes).GetReference() 3339Dim module2_FT1_Ref = ModuleMetadata.CreateFromImage(ilBytes).GetReference() 3346Dim module3_FT2_Ref = ModuleMetadata.CreateFromImage(ilBytes).GetReference() 3377Dim module4_Ref = ModuleMetadata.CreateFromImage(ilBytes).GetReference()
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (1)
MockSymbols.vb (1)
756Public Overrides Function GetMetadata() As ModuleMetadata
Microsoft.CodeAnalysis.Workspaces (21)
FindSymbols\SymbolTree\SymbolTreeInfo_Metadata.cs (3)
272private static ImmutableArray<ModuleMetadata> GetModuleMetadata(Metadata? metadata) 280else if (metadata is ModuleMetadata module) 297foreach (var moduleMetadata in GetModuleMetadata(metadata))
Serialization\SerializedPortableExecutableReference.cs (3)
65MetadataKind={metadata switch { null => "null", AssemblyMetadata => "assembly", ModuleMetadata => "module", _ => metadata.GetType().Name }} 69static ImmutableArray<ModuleMetadata> GetModules(Metadata? metadata) 76else if (metadata is ModuleMetadata moduleMetadata)
Serialization\SerializerService_Reference.cs (15)
224foreach (var module in modules) 230WriteMvidTo((ModuleMetadata)metadata, writer); 233private static bool TryGetModules(AssemblyMetadata assemblyMetadata, out ImmutableArray<ModuleMetadata> modules) 250private static void WriteMvidTo(ModuleMetadata metadata, ObjectWriter writer) 256private static Guid GetMetadataGuid(ModuleMetadata metadata) 342foreach (var module in modules) 348WriteTo((ModuleMetadata)metadata, writer); 387var allMetadata = new FixedSizeArrayBuilder<ModuleMetadata>(count); 412private (ModuleMetadata metadata, TemporaryStorageStreamHandle storageHandle) ReadModuleMetadataFrom( 421(ModuleMetadata metadata, TemporaryStorageStreamHandle storageHandle) ReadModuleMetadataFromMemoryMappedFile() 430(ModuleMetadata metadata, TemporaryStorageStreamHandle storageHandle) ReadModuleMetadataFromBits() 443(ModuleMetadata metadata, TemporaryStorageStreamHandle storageHandle) ReadModuleMetadataFromStorage( 460var metadata = ModuleMetadata.CreateFromMetadata( 474private static void WriteTo(ModuleMetadata metadata, ObjectWriter writer)
Microsoft.VisualStudio.LanguageServices (9)
ProjectSystem\MetadataReferences\VisualStudioMetadataReferenceManager.cs (9)
191private static (ModuleMetadata metadata, TemporaryStorageStreamHandle storageHandle) GetMetadataFromTemporaryStorage( 201var metadata = ModuleMetadata.CreateFromMetadata((IntPtr)stream.PositionPointer, (int)stream.Length, stream.Dispose); 272var metadata = TryCreateModuleMetadataFromMetadataImporter(fullPath); 280ModuleMetadata? TryCreateModuleMetadataFromMetadataImporter(string fullPath) 289var metadata = ModuleMetadata.CreateFromImage(pImage, (int)length); 330Func<string, (ModuleMetadata moduleMetadata, TemporaryStorageStreamHandle? storageHandle)> moduleMetadataFactory) 335var modules = new FixedSizeArrayBuilder<ModuleMetadata>(1 + moduleNames.Length);
Roslyn.Test.PdbUtilities (3)
EditAndContinue\EditAndContinueTest.cs (2)
62var md = ModuleMetadata.CreateFromImage(verifier.EmittedAssemblyData);
EditAndContinue\EditAndContinueTestUtilities.cs (1)
19public static EmitBaseline CreateInitialBaseline(Compilation compilation, ModuleMetadata module, Func<MethodDefinitionHandle, EditAndContinueMethodDebugInformation> debugInformationProvider)
VBCSCompiler (9)
src\Compilers\Server\VBCSCompiler\MetadataCache.cs (9)
23private ModuleMetadata CreateModuleMetadata(string path, bool prefetchEntireImage) 34return ModuleMetadata.CreateFromStream(fileStream, options); 37private ImmutableArray<ModuleMetadata> GetAllModules(ModuleMetadata manifestModule, string assemblyDir) 39ArrayBuilder<ModuleMetadata>? moduleBuilder = null; 45moduleBuilder = ArrayBuilder<ModuleMetadata>.GetInstance(); 49var module = CreateModuleMetadata(PathUtilities.CombineAbsoluteAndRelativePaths(assemblyDir, moduleName)!, prefetchEntireImage: false); 69var result = CreateModuleMetadata(fullPath, prefetchEntireImage: true); 76var primaryModule = CreateModuleMetadata(fullPath, prefetchEntireImage: false);