Auto update local scopes in debug info when manipulating instructions #677
Loading…
Reference in a new issue
No description provided.
Delete branch "UpdateLocalScopes"
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?
Before this change Cecil would not update local scopes when manipulating method bodies. This can lead to corrupted debug info - which when written to a PDB results in corrupted PDB.
Cecil can store local scopes in two ways:
If the local scopes use offset values this change will update the local scopes for all insert and remove operations on the method body. The behaviors for insert is basically "insert after" in that the new instruction is added to the scopes of the previous instruction.
If the local scopes are using instructions directly the change only removes any references to instructions which are being removed from the method body (and replaces them with the instruction offset value).
To be able to tell the difference between these cases the
instructionfield has been made internal in theInstructionOffsetstructure.Fixes #675.
/cc @marek-safar
Thank you!