Keep end-of-method sequence points at the end of the method #987
Loading…
Reference in a new issue
No description provided.
Delete branch "michaelglass/fix-portable-pdb-end-sequence-point"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Read an F# assembly with its portable PDB, insert instructions into a method, write it back, and System.Reflection.Metadata throws on that method's sequence points:
(MS CodeCoverage then silently drops the method.)
Cause: F# emits a hidden sequence point at offset == code size.
CodeReader.ReadSequencePointscan't bind it to an instruction, so it keeps its raw offset. After an insert it's still written at the old offset, behind the previous point, so the blob gets a negative delta.Fix: mark a point read at offset == code size as end-of-method, and move it to the new code size before the symbol writer runs. No public API change; all three symbol writers get the right offset.
Test:
PortablePdbTests.EndOfMethodSequencePointAfterInsertingInstructionsbuildsldc.i4.1; ldc.i4.2; add; retwith points at 0, 3 and hidden 4, insertsldc.i4 42; pop, and checks SRM decodes the points as6, 9, 10. Fails on master with the exception above.Related to #840 and #853, but a different cause: sorting would put this point in the wrong place rather than at the end.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.