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:
https://github.com/dotnet/corefx/blob/a10890f4ffe0fadf090c922578ba0e606ebdd16c/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.EmbeddedPortablePdb.cs#L52-L70
Repro steps
Provide the steps required to reproduce the problem:
- Set
<DebugType>embedded</DebugType> in a .NET Standard .fsproj
- Build
- Pass the built
.dll into 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.
cc @KevinRansom @tmat
When using
DebugType=embeddedwith F# projects, and then trying to load the resulting library withPEReader, I am getting an exception. This is becausePEReaderis validating that the version is at least the expected version:https://github.com/dotnet/corefx/blob/a10890f4ffe0fadf090c922578ba0e606ebdd16c/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.EmbeddedPortablePdb.cs#L52-L70
Repro steps
Provide the steps required to reproduce the problem:
<DebugType>embedded</DebugType>in a .NET Standard .fsproj.dllinto the following code:Expected behavior
PEReadershouldn't throw on the assembly.Actual behavior
Known workarounds
Don't use embedded PDBs.
cc @KevinRansom @tmat