Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Rewriter produces incorrect debug information for async methods in PDB file #483

Open
aleksd opened this issue Mar 9, 2017 · 1 comment

Comments

@aleksd
Copy link

aleksd commented Mar 9, 2017

It looks like CC rewriter produces incorrect table of yield/resume offsets for the MoveNext() method of the async state machine. As a result it's not possible to step through async methods with the VS debugger.

First, if you don't define any conditions in the project with CodeContracts enabled, the rewriter still modifies the IL of the assembly slightly and instruction offsets change. However debug info is not updated accordingly.

Second, if you add some conditions to the project, then debug info is updated but still contains incorrect offsets.

To reproduce, you can open the attached solution in the VS and try to step through Method1(). The debugger loses track of the method execution after the first await. If CodeContracts are disabled, then stepping through the method works correctly again.
AsyncDebugging.zip

@johncrim
Copy link

Note that this is fixed if you create your own build of CodeContracts. It was fixed by using a new version of Cecil if I recall (old version was not async aware). It is not fixed in the public release.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants