Skip to content

stackTrace fails with 0x80004002 on WinForms load-event breakpoints #215

@govert

Description

@govert

Summary

On Windows WinForms debugging, stackTrace can fail with 0x80004002 (E_NOINTERFACE) after a valid stopped event at a user breakpoint in the form load path.

This is reproducible against current master (8b8b22200fecdb1aec5f47af63215462d8c79a4b) and does not appear editor-specific.

Environment

  • OS: Windows 11
  • netcoredbg: master at 8b8b22200fecdb1aec5f47af63215462d8c79a4b
  • Runtime: .NET 10 WinForms
  • Protocol: DAP (--interpreter=vscode)

Repro pattern

A minimal C# WinForms app with:

  • breakpoint in Form1 constructor path (first stop)
  • breakpoint in Form1_Load path (second stop)

Observed behavior:

  1. First breakpoint: stopped + stackTrace succeeds.
  2. Second breakpoint: stopped arrives, then stackTrace fails.

Representative DAP sequence:

<- (E) {"body":{"allThreadsStopped":true,"reason":"breakpoint","threadId":14000},"event":"stopped",...}
-> (C) {"command":"stackTrace","arguments":{"threadId":14000,"startFrame":0,"levels":20},...}
<- (R) {"command":"stackTrace","message":"Failed command 'stackTrace' : 0x80004002",...,"success":false}

Suspected root cause

In WalkFrames() there is an unconditional IID_ICorDebugILFrame QI for managed frames:

  • src/debugger/frames.cpp (around line 345 in current master)

When ICorDebugILFrame is unavailable for a frame in this WinForms path, the error propagates and aborts stack walking instead of degrading to a non-IL frame kind.

Notes

I have a local fix plus a regression test in test-suite and will open a PR linking this issue.

Posted by Codex on behalf of @govert.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions