ReadDebugHeader method change causing a SymbolsNotMatchingException
See original GitHub issueHi,
In https://github.com/jbevain/cecil/pull/349 the ReadDebugHeader method was changed, and we now check
if (directory.AddressOfRawData == 0) {
entries [i] = new ImageDebugHeaderEntry (directory, Empty<byte>.Array);
continue;
}
inside
void ReadDebugHeader ()
{
if (image.Debug.IsZero) {
image.DebugHeader = new ImageDebugHeader (Empty<ImageDebugHeaderEntry>.Array);
return;
}
MoveTo (image.Debug);
var entries = new ImageDebugHeaderEntry [(int) image.Debug.Size / ImageDebugDirectory.Size];
for (int i = 0; i < entries.Length; i++) {
var directory = new ImageDebugDirectory {
Characteristics = ReadInt32 (),
TimeDateStamp = ReadInt32 (),
MajorVersion = ReadInt16 (),
MinorVersion = ReadInt16 (),
Type = (ImageDebugType) ReadInt32 (),
SizeOfData = ReadInt32 (),
AddressOfRawData = ReadInt32 (),
PointerToRawData = ReadInt32 (),
};
if (directory.AddressOfRawData == 0) {
entries [i] = new ImageDebugHeaderEntry (directory, Empty<byte>.Array);
continue;
}
var position = Position;
try {
MoveTo ((uint) directory.PointerToRawData);
var data = ReadBytes (directory.SizeOfData);
entries [i] = new ImageDebugHeaderEntry (directory, data);
} finally {
Position = position;
}
}
image.DebugHeader = new ImageDebugHeader (entries);
}
We have a scenario in which we use il-repack to merge dlls (together with pdbs). Currently il-repack is using the old version of Cecil and this part works. We want to unfork cecil in https://github.com/gluck/il-repack/pull/236 and use the current version but it seems that symbol files for IKVM’ed dlls are not read correctly now.
I tracked down the issue to that part of the code. In our IKVM symbol file the AddressOfRawData is 0. But the PointerToRawData is correct and if we skip that check (using debugger) then the behavior works as before.
Is that check necessary? Can we remove it?
Unfortunately I can’t add the dll plus pdb which are problematic but I will try to generate dummy dlls and attach them here.
Thank you
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)

Top Related StackOverflow Question
Thanks for the test, unfortunately it’s not self contained and requires to resolve at least IKVM.Runtime, so I can’t take the test as it is. I’ve pushed a quick fix, but would love a self contained test.
Another quick question, do you know when 0.11 will be released? Perhaps even a beta version we could reference.