-
Notifications
You must be signed in to change notification settings - Fork 831
Closed
Description
When using DebugType=embedded with F# projects, and then trying to load the resulting library with PEReader, I am getting an exception. This is because PEReader is validating that the version is at least the expected version:
Repro steps
Provide the steps required to reproduce the problem:
- Set
<DebugType>embedded</DebugType>in a .NET Standard .fsproj - Build
- Pass the built
.dllinto the following code:
string filename = ...;
using (var fileStream = File.OpenRead(filename))
{
PEReader reader = new PEReader(fileStream);
foreach (var entry in reader.ReadDebugDirectory())
{
if (entry.Type == DebugDirectoryEntryType.EmbeddedPortablePdb)
{
reader.ReadEmbeddedPortablePdbDebugDirectoryData(entry);
}
}
}Expected behavior
PEReader shouldn't throw on the assembly.
Actual behavior
System.BadImageFormatException
HResult=0x8007000B
Message=Unsupported format version: 0.0
Source=System.Reflection.Metadata
StackTrace:
at System.Reflection.PortableExecutable.PEReader.ValidateEmbeddedPortablePdbVersion(DebugDirectoryEntry entry) in F:\workspace\_work\1\s\src\System.Reflection.Metadata\src\System\Reflection\PortableExecutable\PEReader.EmbeddedPortablePdb.cs:line 62
Known workarounds
Don't use embedded PDBs.