You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Debugger shows incorrect thread state if "continued" arrives too soon after a "stopped" (or "started"?) #238591
Yet the UI shows the thread as paused. I was able to reproduce this in MockDebug. It seems to only occur when the events occur close together (if I add delays, it doesn't seem to happen):
// Start additional threads, pause on entry, continue.for(vari=2;i<5;i++){this._threads.push(newThread(i,`Thread ${i}`));this.sendEvent(newThreadEvent('started',i));this.sendEvent(newOutputEvent(`Thread ${i} started\n`));this.sendEvent(newStoppedEvent('entry',i));this.sendEvent(newOutputEvent(`Thread ${i} stopped on entry\n`));// await this.delay(1); // Uncomment this to fix itthis.sendEvent(newContinuedEvent(i,false));this.sendEvent(newOutputEvent(`Thread ${i} continued\n`));}
This felt a bit like microsoft/debug-adapter-protocol#513 to me, but that actually turned out to be caused by allThreadsStopped defaulting to true. I don't believe that's the case here because in the real project where this happens (Dart debugger), we set both allThreadsStopped and allThreadsContinued to false (though I haven't set allThreadsContinued in the MockDebug example because it doesn't seem to be available in the constructor... I don't believe that's the issue though as allThreadsContinued seems to default to false and the delay shouldn't fix the issue in that case).
I think this is because we have not done fetchThreads yet when the 'continue' event comes in. Connor Peet (@connor4312) this might be from #197397 (or maybe it predates that, not sure)
Probably we need to force waiting on a fetchThreads when we get an event for a thread that we don't know about yet.
roblourensConnor Peet (@connor4312) I'm unfamiliar with this code but there's a Copilot button in the sidebar so I figured I'd see what it did given the comments above.
The fix seems to match your suggestion, although the test seems a bit of a mess. If this looks like the right approach, I could try to write a better test (and verify the fix against my repros above).
Activity
vasilich6107 commentedon Jun 3, 2025
Rodsevich commentedon Jun 30, 2025
yohanangulo commentedon Jul 20, 2025
vasilich6107 commentedon Jul 20, 2025
ChuckPG commentedon Jul 30, 2025
roblourens commentedon Jul 31, 2025
I think this is because we have not done
fetchThreadsyet when the 'continue' event comes in. Connor Peet (@connor4312) this might be from #197397 (or maybe it predates that, not sure)Probably we need to force waiting on a
fetchThreadswhen we get an event for a thread that we don't know about yet.Mercutio1243 commentedon Aug 1, 2025
Is there an update on this?
I did not face this issue last year, only now when setting up VS Code on my new laptop.
Is there a workaround such as downgrading VS Code to earlier versions to avoid this?
luishugoooo commentedon Aug 10, 2025
diegocontini commentedon Aug 16, 2025
sprite2005 commentedon Aug 25, 2025
DanTup commentedon Aug 26, 2025
roblourens Connor Peet (@connor4312) I'm unfamiliar with this code but there's a Copilot button in the sidebar so I figured I'd see what it did given the comments above.
It did this:
DanTup@8dce956
The fix seems to match your suggestion, although the test seems a bit of a mess. If this looks like the right approach, I could try to write a better test (and verify the fix against my repros above).
connor4312 commentedon Sep 8, 2025
Thanks for the nice repro 🙏
debug: fix incorrect thread state if "continued" arrives too soon aft…
debug: fix incorrect thread state if "continued" arrives too soon aft…