The debugging support in System.Reflection.Emit is rather poor and dodgy (and to a certain extent this applies to IKVM.Reflection, as it inherits part of the corruption from the base API of the .pdb script, which should be used since the .pdb file format is not documented).
In any case, the reason the sample does not work is because the following code is missing:
ISymbolDocumentWriter doc = myModule.DefineDocument("sourcefile", Guid.Empty, Guid.Empty, Guid.Empty); myMethodIL.MarkSequencePoint(doc, 1, 0, 1, 0);
The method must have at least one point in the sequence, because this is how internal data structures are related to each other.
source share