Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Loss of debug info in async methods

See original GitHub issue


there seems to be a problem with debug info in async methods: local variables disappear (this is visible in the provided sample) and it seems that the trace (step over from debugger) is also broken (but this is not visible from the sample).

Here is how to reproduce the problem using the attached solution:

  • first of all, if you run the debugger on the project DnlibAsync, when you trace into the method named Async(), you can see that the local variable is visible, and correctly set.
  • now, run the LoadSaveAssembly project: it will load DnlibAsync.exe and DnlibAsync.pdb from obj directory using dnlib and simply write them to bin.
  • when you start the debugger in the project DnlibAsync, now the local variable in Async() method has disappeared (the method works, the generated code has not changed, so this must be the debug info which has changed).

I tried used both symbol loaders (PdbImplType.Managed an PdbImplType.MicrosoftCOM) and get the same result.

Since the example is dumb as hell, I don’t see a point I could have missed in my implementation (which of course, doesn’t mean I 100% sure I made everything right 😎). So, do you think this is a bug?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:16

github_iconTop GitHub Comments

0xd4dcommented, Jun 23, 2017

@picrap I’ll have a look at it this month, I don’t know how long it will take. There’s a lot of undocumented things, but source code (i.e., Roslyn, Pdb2Xml) exist.

picrapcommented, Jun 22, 2017

@0xd4d any schedule for this? I am quite stuck with this (and my projects are also impacted).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why can't I debug code in an async method?
When I run the application, the debugger will call into my GetDataAsync() method which in turn calls into the GetData() method.
Read more >
Psychic Debugging of Async Methods
This symptom is oftem caused by one of three things, or variations off of these: A) An async lambda is passed to a...
Read more >
Why is Async code hard to debug? - YouTube
Isadora Rodopoulos, an engineer on the Visual Studio Debugging team, joins us to kick off a mini-series on debugging async code.
Read more >
Why exceptions in async methods are “dangerous” in C# | ...
If we debug the result, it shows that we have two exceptions, but with no possibility of doing something more accurate in terms...
Read more >
Problem Inspecting local variables in Async method. : r/swift
This is making it really difficult to debug async code. Does anyone know if there is a fix for this, or why it's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found