107 references to PEStreamOptions
Microsoft.AspNetCore.App.UnitTests (7)
PackageTests.cs (2)
97using var peReader = new PEReader(fileStream, PEStreamOptions.Default); 127using var peReader = new PEReader(fileStream, PEStreamOptions.Default);
SharedFxTests.cs (2)
188using var peReader = new PEReader(fileStream, PEStreamOptions.Default); 235using var peReader = new PEReader(fileStream, PEStreamOptions.Default);
TargetingPackTests.cs (3)
85using var peReader = new PEReader(fileStream, PEStreamOptions.Default); 119using var peReader = new PEReader(fileStream, PEStreamOptions.Default); 201using var peReader = new PEReader(fileStream, PEStreamOptions.Default);
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (1)
RazorReferenceManager.cs (1)
77var moduleMetadata = ModuleMetadata.CreateFromStream(stream, PEStreamOptions.PrefetchMetadata);
Microsoft.CodeAnalysis (25)
CommandLine\CommonCompiler.cs (1)
214return MetadataReference.CreateFromFile(peStream, path, PEStreamOptions.PrefetchEntireImage, properties, documentation: null);
MetadataReference\AssemblyMetadata.cs (1)
149public static AssemblyMetadata CreateFromStream(Stream peStream, PEStreamOptions options)
MetadataReference\MetadataReference.cs (10)
151/// deterministically use <see cref="AssemblyMetadata.CreateFromStream(Stream, PEStreamOptions)"/> 186/// It is recommended to use <see cref="AssemblyMetadata.CreateFromStream(Stream, PEStreamOptions)"/> or <see cref="ModuleMetadata.CreateFromStream(Stream, PEStreamOptions)"/> 193/// the lifetime deterministically use <see cref="AssemblyMetadata.CreateFromStream(Stream, PEStreamOptions)"/> 208MetadataImageKind.Module => ModuleMetadata.CreateFromStream(peStream, PEStreamOptions.PrefetchEntireImage), 209_ => AssemblyMetadata.CreateFromStream(peStream, PEStreamOptions.PrefetchEntireImage), 248PEStreamOptions.PrefetchEntireImage, 254PEStreamOptions options, 267PEStreamOptions options, 373return CreateFromFile(peStream, filePath, PEStreamOptions.Default, properties, documentation);
MetadataReference\ModuleMetadata.cs (13)
187return CreateFromStream(peStream, leaveOpen ? PEStreamOptions.LeaveOpen : PEStreamOptions.Default); 196/// Unless <see cref="PEStreamOptions.LeaveOpen"/> is specified, the responsibility for disposal of the stream is transferred upon entry of the constructor 203/// <see cref="PEStreamOptions.PrefetchMetadata"/> or <see cref="PEStreamOptions.PrefetchEntireImage"/> is specified and the PE headers of the image are invalid. 206/// <see cref="PEStreamOptions.PrefetchMetadata"/> or <see cref="PEStreamOptions.PrefetchEntireImage"/> is specified and an error occurs while reading the stream. 208public static ModuleMetadata CreateFromStream(Stream peStream, PEStreamOptions options) 220var prefetch = (options & (PEStreamOptions.PrefetchEntireImage | PEStreamOptions.PrefetchMetadata)) != 0; 232Action? onDispose = options.HasFlag(PEStreamOptions.LeaveOpen) 244if (peStream.Length == 0 && (options & PEStreamOptions.PrefetchEntireImage) != 0 && (options & PEStreamOptions.PrefetchMetadata) != 0)
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (1)
CommandLineTests.cs (1)
8929using (var peReader = new PEReader(stream, PEStreamOptions.LeaveOpen))
Microsoft.CodeAnalysis.CSharp.Scripting (2)
Hosting\CommandLine\Csi.cs (2)
18private readonly Func<string, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference> _createFromFileFunc; 25Func<string, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference>? createFromFileFunc = null)
Microsoft.CodeAnalysis.Features (1)
Emit\CompilationOutputs.cs (1)
54using (var peReader = new PEReader(peStream, PEStreamOptions.LeaveOpen))
Microsoft.CodeAnalysis.LanguageServer.Protocol (6)
Features\DecompiledSource\AssemblyResolver.cs (4)
63public PEFile TryResolve(MetadataReference metadataReference, PEStreamOptions streamOptions) 135var result = TryResolve(reference, PEStreamOptions.PrefetchMetadata); 143return new PEFile(reference.Display, PEStreamOptions.PrefetchMetadata); 166return new PEFile(moduleFileName, PEStreamOptions.PrefetchMetadata);
Features\DecompiledSource\CSharpCodeDecompilerDecompilationService.cs (2)
45file = resolver.TryResolve(metadataReference, PEStreamOptions.PrefetchEntireImage); 48file = new PEFile(assemblyLocation, PEStreamOptions.PrefetchEntireImage);
Microsoft.CodeAnalysis.Scripting (12)
Hosting\CommandLine\CommandLineRunner.cs (4)
27private readonly Func<string, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference> _createFromFileFunc; 34Func<string, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference>? createFromFileFunc = null) 185Func<string, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference> createFromFileFunc) 193return createFromFileFunc(path, PEStreamOptions.PrefetchEntireImage, properties);
Hosting\Resolvers\RuntimeMetadataReferenceResolver.cs (1)
91_createFromFileFunc = createFromfileFunc ?? ((path, properties) => Script.CreateFromFile(path, PEStreamOptions.PrefetchEntireImage, properties));
Script.cs (4)
316Func<string, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference> createFromFileFunc) 321return createFromFileFunc(filePath, PEStreamOptions.Default, properties); 325/// <see cref="MetadataReference.CreateFromFile(string, PEStreamOptions, MetadataReferenceProperties, DocumentationProvider)"/> 335PEStreamOptions options,
ScriptOptions.cs (3)
143internal Func<string, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference> CreateFromFileFunc { get; private set; } 158Func<string, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference>? createFromFileFunc = null) 394internal ScriptOptions WithCreateFromFileFunc(Func<string, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference> createFromFileFunc)
Microsoft.CodeAnalysis.Scripting.TestUtilities (2)
ScriptTestBase.cs (2)
35(path, properties) => CreateFromFile(path, PEStreamOptions.PrefetchEntireImage, properties)); 42private protected MetadataImageReference CreateFromFile(string filePath, PEStreamOptions options, MetadataReferenceProperties properties)
Microsoft.CodeAnalysis.UnitTests (15)
MetadataReferences\ModuleMetadataTests.cs (15)
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)); 292[InlineData(PEStreamOptions.PrefetchEntireImage)] 293[InlineData(PEStreamOptions.PrefetchMetadata)] 294[InlineData(PEStreamOptions.PrefetchEntireImage | PEStreamOptions.PrefetchMetadata)] 295public unsafe void CreateFromUnmanagedMemoryStream_Prefetch_LeaveOpenFalse(PEStreamOptions options) 323[InlineData(PEStreamOptions.PrefetchEntireImage)] 324[InlineData(PEStreamOptions.PrefetchMetadata)] 325[InlineData(PEStreamOptions.PrefetchEntireImage | PEStreamOptions.PrefetchMetadata)] 326public unsafe void CreateFromUnmanagedMemoryStream_Prefetcha_LeaveOpenTrue(PEStreamOptions options) 339var metadata = ModuleMetadata.CreateFromStream(stream, options | PEStreamOptions.LeaveOpen);
Microsoft.CodeAnalysis.VisualBasic.Scripting (2)
Hosting\CommandLine\Vbi.vb (2)
18Private ReadOnly _createFromFileFunc As Func(Of String, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference) 20Friend Sub New(responseFile As String, buildPaths As BuildPaths, args As String(), analyzerLoader As IAnalyzerAssemblyLoader, Optional createFromFileFunc As Func(Of String, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference) = Nothing)
Microsoft.DotNet.Build.Tasks.Packaging (1)
VersionUtility.cs (1)
37using (PEReader peReader = new PEReader(assemblyStream, PEStreamOptions.LeaveOpen))
System.Reflection.Metadata (29)
System\Reflection\PortableExecutable\PEReader.cs (24)
100: this(peStream, PEStreamOptions.Default) 111/// Unless <see cref="PEStreamOptions.LeaveOpen"/> is specified, ownership of the stream is transferred to the <see cref="PEReader"/> 114/// Unless <see cref="PEStreamOptions.PrefetchMetadata"/> or <see cref="PEStreamOptions.PrefetchEntireImage"/> is specified no data 118/// If <see cref="PEStreamOptions.PrefetchMetadata"/> or <see cref="PEStreamOptions.PrefetchEntireImage"/>, the <see cref="PEReader"/> 119/// will have read all of the data requested during construction. As such, if <see cref="PEStreamOptions.LeaveOpen"/> is also 126/// <exception cref="BadImageFormatException"><see cref="PEStreamOptions.PrefetchMetadata"/> is specified and the PE headers of the image are invalid.</exception> 127public PEReader(Stream peStream, PEStreamOptions options) 140/// Unless <see cref="PEStreamOptions.LeaveOpen"/> is specified, ownership of the stream is transferred to the <see cref="PEReader"/> 143/// Unless <see cref="PEStreamOptions.PrefetchMetadata"/> or <see cref="PEStreamOptions.PrefetchEntireImage"/> is specified no data 147/// If <see cref="PEStreamOptions.PrefetchMetadata"/> or <see cref="PEStreamOptions.PrefetchEntireImage"/>, the <see cref="PEReader"/> 148/// will have read all of the data requested during construction. As such, if <see cref="PEStreamOptions.LeaveOpen"/> is also 154/// <exception cref="BadImageFormatException"><see cref="PEStreamOptions.PrefetchMetadata"/> is specified and the PE headers of the image are invalid.</exception> 155public unsafe PEReader(Stream peStream, PEStreamOptions options, int size) 172IsLoadedImage = (options & PEStreamOptions.IsLoadedImage) != 0; 180if ((options & (PEStreamOptions.PrefetchMetadata | PEStreamOptions.PrefetchEntireImage)) == 0) 182_peImage = new StreamMemoryBlockProvider(peStream, start, actualSize, (options & PEStreamOptions.LeaveOpen) != 0); 188if ((options & PEStreamOptions.PrefetchEntireImage) != 0) 195if ((options & PEStreamOptions.PrefetchMetadata) != 0) 215if (closeStream && (options & PEStreamOptions.LeaveOpen) == 0)
System\Reflection\PortableExecutable\PEStreamOptions.cs (5)
46public static bool IsValid(this PEStreamOptions options) 48return (options & ~(PEStreamOptions.LeaveOpen | PEStreamOptions.PrefetchEntireImage | PEStreamOptions.PrefetchMetadata | PEStreamOptions.IsLoadedImage)) == 0;
VBCSCompiler (3)
src\Compilers\Server\VBCSCompiler\MetadataCache.cs (3)
28var options = PEStreamOptions.PrefetchMetadata; 31options |= PEStreamOptions.PrefetchEntireImage;