5 instantiations of MetadataReaderProvider
System.Reflection.Metadata (5)
System\Reflection\Metadata\MetadataReaderProvider.cs (4)
83return new MetadataReaderProvider(new ExternalMemoryBlockProvider(start, size)); 111return new MetadataReaderProvider(new ByteArrayMemoryProvider(image)); 189result = new MetadataReaderProvider(new StreamMemoryBlockProvider(stream, start, actualSize, (options & MetadataStreamOptions.LeaveOpen) != 0)); 195result = new MetadataReaderProvider(StreamMemoryBlockProvider.ReadMemoryBlockNoLock(stream, start, actualSize));
System\Reflection\PortableExecutable\PEReader.EmbeddedPortablePdb.cs (1)
44return new MetadataReaderProvider(DecodeEmbeddedPortablePdbDebugDirectoryData(block));
120 references to MetadataReaderProvider
BuildValidator (2)
CompilationDiff.cs (1)
185return MetadataReaderProvider.FromPortablePdbStream(rebuildPdbStream).GetMetadataReader();
Program.cs (1)
320out var pdbReaderProvider,
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (5)
CommandLineTests.cs (5)
2259using (var mdProvider = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(entry)) 2288using (var mdProvider = MetadataReaderProvider.FromPortablePdbStream(pdbStream)) 2483using (var mdProvider = isEmbeddedPdb ? 2485MetadataReaderProvider.FromPortablePdbStream(File.OpenRead(Path.Combine(dir.Path, "embed.pdb"))))
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (20)
Emit\EditAndContinue\EditAndContinuePdbTests.cs (4)
175using var pdbProvider = MetadataReaderProvider.FromPortablePdbImage(diff1.PdbDelta); 304using var pdbProvider = MetadataReaderProvider.FromPortablePdbImage(diff2.PdbDelta);
Emit\EditAndContinue\EditAndContinueTests.cs (2)
12457using var provider = MetadataReaderProvider.FromPortablePdbStream(new MemoryStream(diff1.PdbDelta.ToArray()));
PDB\CSharpDeterministicBuildCompilationTests.cs (1)
81using (var embeddedPdb = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(embedded))
PDB\PDBAsyncTests.cs (2)
2045using var provider = MetadataReaderProvider.FromPortablePdbStream(pdbStream);
PDB\PDBEmbeddedSourceTests.cs (1)
116using (var embeddedMetadataProvider = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(embeddedEntry))
PDB\PDBIteratorTests.cs (2)
1638using var provider = MetadataReaderProvider.FromPortablePdbStream(pdbStream);
PDB\PDBSourceLinkTests.cs (1)
89using (var embeddedMetadataProvider = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(embeddedEntry))
PDB\PortablePdbTests.cs (5)
189using (var embeddedMetadataProvider = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(embedded)) 250using (var embeddedMetadataProvider = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(embedded)) 307using (var provider = MetadataReaderProvider.FromPortablePdbStream(pdbStream)) 350using (var embeddedMetadataProvider = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(embeddedEntry))
PDB\TypeDefinitionDocumentTests.cs (2)
473using var provider = MetadataReaderProvider.FromPortablePdbStream(pdbStream);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
Emit\CompilationOutputFilesTests.cs (1)
50using (var metadata = outputs.OpenAssemblyMetadata(prefetch: false))
Microsoft.CodeAnalysis.Features (16)
Debugging\DebugInformationReaderProvider.cs (4)
42private sealed class Portable(MetadataReaderProvider pdbReaderProvider) : DebugInformationReaderProvider 44private readonly MetadataReaderProvider _pdbReaderProvider = pdbReaderProvider; 141return new Portable(MetadataReaderProvider.FromPortablePdbStream(stream)); 164public static DebugInformationReaderProvider CreateFromMetadataReader(MetadataReaderProvider metadataProvider)
EditAndContinue\DebuggingSession.cs (2)
332if (!TryCreateInitialBaseline(baselineCompilation, outputs, baselineProject.Id, out diagnostics, out var initialBaseline, out var debugInfoReaderProvider, out var metadataReaderProvider)) 365[NotNullWhen(true)] out MetadataReaderProvider? metadataReaderProvider)
Emit\CompilationOutputs.cs (5)
36/// otherwise keeps the underlying stream open until the returned <see cref="MetadataReaderProvider"/> is disposed. 39/// Instance of <see cref="MetadataReaderProvider"/>, which owns the opened metadata and must be disposed once the caller is done reading the data, 45public virtual MetadataReaderProvider? OpenAssemblyMetadata(bool prefetch) 60return MetadataReaderProvider.FromMetadataStream( 72using var metadataProvider = OpenAssemblyMetadata(prefetch: false);
PdbSourceDocument\DocumentDebugInfoReader.cs (2)
21private readonly MetadataReaderProvider _pdbReaderProvider; 27public DocumentDebugInfoReader(PEReader peReader, MetadataReaderProvider pdbReaderProvider)
PdbSourceDocument\PdbFileLocatorService.cs (3)
43if (peReader.TryOpenAssociatedPortablePdb(dllPath, ReadFileIfExists, out var pdbReaderProvider, out var pdbFilePath)) 83var readerProvider = MetadataReaderProvider.FromPortablePdbStream(pdbStream);
Microsoft.CodeAnalysis.Features.Test.Utilities (1)
EditAndContinue\EditAndContinueWorkspaceTestBase.cs (1)
353if (reader is MetadataReaderProvider md)
Microsoft.CodeAnalysis.Rebuild (1)
Extensions.cs (1)
32var provider = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(entry);
Microsoft.CodeAnalysis.Rebuild.UnitTests (3)
RoundTripUtil.cs (3)
40var portablePdbReader = pdbStream is not null ? MetadataReaderProvider.FromPortablePdbStream(pdbStream).GetMetadataReader() : null; 124rebuildPdbReader = MetadataReaderProvider.FromPortablePdbImage(rebuildPdbBytes).GetMetadataReader(); 155var originalPdbReader = MetadataReaderProvider.FromPortablePdbImage(pdbBytes).GetMetadataReader();
Microsoft.CodeAnalysis.Test.Utilities (1)
Compilation\IRuntimeEnvironment.cs (1)
60using (var embeddedMetadataProvider = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(portablePdbEntry))
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (3)
CommandLineTests.vb (3)
3231Using mdProvider = MetadataReaderProvider.FromPortablePdbStream(pdbStream) 3404Using mdProvider As MetadataReaderProvider = If( 3407MetadataReaderProvider.FromPortablePdbStream(File.OpenRead(Path.Combine(dir.Path, "embed.pdb"))))
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (8)
Emit\EditAndContinue\EditAndContinuePdbTests.vb (2)
177Using pdbProvider = MetadataReaderProvider.FromPortablePdbImage(diff1.PdbDelta) 286Using pdbProvider = MetadataReaderProvider.FromPortablePdbImage(diff2.PdbDelta)
PDB\PDBAsyncTests.vb (1)
895Using provider = MetadataReaderProvider.FromPortablePdbStream(pdbStream)
PDB\PDBEmbeddedSourceTests.vb (1)
97Using embeddedMetadataProvider As MetadataReaderProvider = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(embeddedEntry)
PDB\PDBIteratorTests.vb (1)
556Using provider = MetadataReaderProvider.FromPortablePdbStream(pdbStream)
PDB\PortablePdbTests.vb (1)
203Using provider = MetadataReaderProvider.FromPortablePdbStream(pdbStream)
PDB\TypeDefinitionDocumentTests.vb (1)
355Using provider = MetadataReaderProvider.FromPortablePdbStream(pdbStream)
PDB\VisualBasicDeterministicBuildCompilationTests.vb (1)
60Using embeddedPdb As MetadataReaderProvider = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(embedded)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (2)
ProjectSystemShim\VisualStudioCompilationOutputFilesTests.cs (2)
60using (var metadata = outputs.OpenAssemblyMetadata(prefetch: false)) 99using (var metadata = outputs.OpenAssemblyMetadata(prefetch: false))
Roslyn.Test.PdbUtilities (3)
Reader\PdbValidation.cs (3)
600using (var provider = MetadataReaderProvider.FromPortablePdbStream(portablePdbStreamOpt, MetadataStreamOptions.LeaveOpen)) 632using (var provider = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(entry))
System.Diagnostics.StackTrace (9)
System\Diagnostics\StackTraceSymbols.cs (9)
15private readonly ConditionalWeakTable<Assembly, MetadataReaderProvider?> _metadataCache; 22_metadataCache = new ConditionalWeakTable<Assembly, MetadataReaderProvider?>(); 30foreach ((Assembly _, MetadataReaderProvider? provider) in _metadataCache) 124MetadataReaderProvider? provider; 143private static unsafe MetadataReaderProvider? TryOpenReaderForInMemoryPdb(IntPtr inMemoryPdbAddress, int inMemoryPdbSize) 155var provider = MetadataReaderProvider.FromMetadataImage((byte*)inMemoryPdbAddress, inMemoryPdbSize); 185private static MetadataReaderProvider? TryOpenReaderFromAssemblyFile(string assemblyPath, IntPtr loadedPeAddress, int loadedPeSize, bool isFileLayout) 197MetadataReaderProvider? provider;
System.Reflection.Metadata (45)
System\Reflection\Metadata\MetadataReaderProvider.cs (31)
53/// The memory is owned by the caller and not released on disposal of the <see cref="MetadataReaderProvider"/>. 54/// The caller is responsible for keeping the memory alive and unmodified throughout the lifetime of the <see cref="MetadataReaderProvider"/>. 55/// The content of the blob is not read during the construction of the <see cref="MetadataReaderProvider"/> 57public static unsafe MetadataReaderProvider FromPortablePdbImage(byte* start, int size) => FromMetadataImage(start, size); 67/// The memory is owned by the caller and not released on disposal of the <see cref="MetadataReaderProvider"/>. 68/// The caller is responsible for keeping the memory alive and unmodified throughout the lifetime of the <see cref="MetadataReaderProvider"/>. 69/// The content of the blob is not read during the construction of the <see cref="MetadataReaderProvider"/> 71public static unsafe MetadataReaderProvider FromMetadataImage(byte* start, int size) 91/// The content of the image is not read during the construction of the <see cref="MetadataReaderProvider"/> 94public static MetadataReaderProvider FromPortablePdbImage(ImmutableArray<byte> image) => FromMetadataImage(image); 101/// The content of the image is not read during the construction of the <see cref="MetadataReaderProvider"/> 104public static MetadataReaderProvider FromMetadataImage(ImmutableArray<byte> image) 122/// Unless <see cref="MetadataStreamOptions.LeaveOpen"/> is specified, ownership of the stream is transferred to the <see cref="MetadataReaderProvider"/> 123/// upon successful argument validation. It will be disposed by the <see cref="MetadataReaderProvider"/> and the caller must not manipulate it. 126/// is read from the stream during the construction of the <see cref="MetadataReaderProvider"/>. Furthermore, the stream must not be manipulated 127/// by caller while the <see cref="MetadataReaderProvider"/> is alive and undisposed. 129/// If <see cref="MetadataStreamOptions.PrefetchMetadata"/>, the <see cref="MetadataReaderProvider"/> 131/// specified, the caller retains full ownership of the stream and is assured that it will not be manipulated by the <see cref="MetadataReaderProvider"/> 137public static MetadataReaderProvider FromPortablePdbStream(Stream stream, MetadataStreamOptions options = MetadataStreamOptions.Default, int size = 0) => FromMetadataStream(stream, options, size); 147/// Unless <see cref="MetadataStreamOptions.LeaveOpen"/> is specified, ownership of the stream is transferred to the <see cref="MetadataReaderProvider"/> 148/// upon successful argument validation. It will be disposed by the <see cref="MetadataReaderProvider"/> and the caller must not manipulate it. 151/// is read from the stream during the construction of the <see cref="MetadataReaderProvider"/>. Furthermore, the stream must not be manipulated 152/// by caller while the <see cref="MetadataReaderProvider"/> is alive and undisposed. 154/// If <see cref="MetadataStreamOptions.PrefetchMetadata"/>, the <see cref="MetadataReaderProvider"/> 156/// specified, the caller retains full ownership of the stream and is assured that it will not be manipulated by the <see cref="MetadataReaderProvider"/> 163public static MetadataReaderProvider FromMetadataStream(Stream stream, MetadataStreamOptions options = MetadataStreamOptions.Default, int size = 0) 183MetadataReaderProvider result; 216/// It is not safe to call <see cref="Dispose"/> in parallel with any other operation on the <see cref="MetadataReaderProvider"/> 231/// Gets a <see cref="MetadataReader"/> from a <see cref="MetadataReaderProvider"/>. 234/// The caller must keep the <see cref="MetadataReaderProvider"/> undisposed throughout the lifetime of the metadata reader. 285throw new ObjectDisposedException(nameof(MetadataReaderProvider));
System\Reflection\Metadata\MetadataStreamOptions.cs (4)
10/// By default the stream is disposed when <see cref="MetadataReaderProvider"/> is disposed and sections of the PE image are read lazily. 15/// Keep the stream open when the <see cref="MetadataReaderProvider"/> is disposed. 23/// The underlying file may be closed and even deleted after <see cref="MetadataReaderProvider"/> is constructed. 24/// <see cref="MetadataReaderProvider"/> closes the stream automatically by the time the constructor returns unless <see cref="LeaveOpen"/> is specified.
System\Reflection\PortableExecutable\PEReader.cs (7)
690/// If successful, a new instance of <see cref="MetadataReaderProvider"/> to be used to read the Portable PDB,. 712public bool TryOpenAssociatedPortablePdb(string peImagePath, Func<string, Stream?> pdbFileStreamProvider, out MetadataReaderProvider? pdbReaderProvider, out string? pdbPath) 770private bool TryOpenCodeViewPortablePdb(DebugDirectoryEntry codeViewEntry, string peImageDirectory, Func<string, Stream?> pdbFileStreamProvider, out MetadataReaderProvider? provider, out string? pdbPath, ref Exception? errorToReport) 805private static bool TryOpenPortablePdbFile(string path, BlobContentId id, Func<string, Stream?> pdbFileStreamProvider, out MetadataReaderProvider? provider, ref Exception? errorToReport) 808MetadataReaderProvider? candidate = null; 834candidate = MetadataReaderProvider.FromPortablePdbStream(pdbStream); 859partial void TryOpenEmbeddedPortablePdb(DebugDirectoryEntry embeddedPdbEntry, ref bool openedEmbeddedPdb, ref MetadataReaderProvider? provider, ref Exception? errorToReport);
System\Reflection\PortableExecutable\PEReader.EmbeddedPortablePdb.cs (3)
34public unsafe MetadataReaderProvider ReadEmbeddedPortablePdbDebugDirectoryData(DebugDirectoryEntry entry) 142partial void TryOpenEmbeddedPortablePdb(DebugDirectoryEntry embeddedPdbEntry, ref bool openedEmbeddedPdb, ref MetadataReaderProvider? provider, ref Exception? errorToReport) 145MetadataReaderProvider? candidate = null;