Skip to content

Fix WinForms stackTrace E_NOINTERFACE by tolerating non-IL managed frames#216

Open
govert wants to merge 1 commit into
Samsung:masterfrom
govert:fix/winforms-stacktrace-e-nointerface
Open

Fix WinForms stackTrace E_NOINTERFACE by tolerating non-IL managed frames#216
govert wants to merge 1 commit into
Samsung:masterfrom
govert:fix/winforms-stacktrace-e-nointerface

Conversation

@govert
Copy link
Copy Markdown

@govert govert commented Feb 11, 2026

Fixes #215

AHub link

N/A

Summary

This change prevents stackTrace from failing with 0x80004002 when a managed frame does not expose ICorDebugILFrame (observed in WinForms load-event call paths).

Root cause

WalkFrames() treated a failed IID_ICorDebugILFrame QI as fatal for managed frames. In the failing WinForms path, that QI fails for some frames, and the whole stack walk aborted.

Fix

In src/debugger/frames.cpp:

  • If IID_ICorDebugILFrame QI fails, do not return failure.
  • Try IID_ICorDebugInternalFrame and emit FrameCLRInternal when available.
  • Otherwise emit FrameUnknown.
  • Continue walking remaining frames.

This keeps stackTrace successful while preserving frame visibility.

Tests

Added a targeted regression test:

  • test-suite/VSCodeTestStackTraceWinForms
  • helper target app test-suite/TestAppWinFormsStackTrace

The test:

  1. Launches WinForms target.
  2. Breaks in constructor (Form1), asserts stackTrace success.
  3. Continues to Form1_Load, asserts stackTrace success on the previously failing path.
  4. Terminates/disconnects cleanly.

Registered in:

  • test-suite/run_tests.ps1
  • test-suite/run_tests.sh
  • test-suite/sdb_run_tests.ps1
  • test-suite/sdb_run_tests.sh

Local verification

Ran:

dotnet run --project TestRunner -- --local ../bin/netcoredbg.exe --proto vscode --test VSCodeTestStackTraceWinForms --sources VSCodeTestStackTraceWinForms/Program.cs --assembly VSCodeTestStackTraceWinForms/bin/Debug/netcoreapp3.1/VSCodeTestStackTraceWinForms.dll

Result: Success: Test case "VSCodeTestStackTraceWinForms" is passed!!!

Posted by Codex on behalf of @govert.

@viewizard
Copy link
Copy Markdown
Member

Thanks! I just check this fix manually, changes in debugger's code looks good for me. Will move this PR into our internal CI for testing.

@21Beagle
Copy link
Copy Markdown

Hi, can I politely ask if is there any update on this? I am finding myself coming back here daily to see if this has been added to the latest version of netcoredbg

Thanks

@gbalykov
Copy link
Copy Markdown
Member

gbalykov commented May 4, 2026

@21Beagle this looks good. We've moved this to internal repo, will be part of next release here (probably in May). For now, as a workaround you can build from source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stackTrace fails with 0x80004002 on WinForms load-event breakpoints

4 participants