feat: Add crash dump capture and analysis to --debug-output#414
feat: Add crash dump capture and analysis to --debug-output#414
Conversation
Build Metrics ReportBinary Sizes
Test Results✅ 718 passed out of 718 tests in 368.7s (+4 tests, -6.3s vs. baseline) Test Coverage❌ 20.6% line coverage, 35.8% branch coverage · CLI Startup Time39ms median (x64, Updated 2026-04-10 00:02:10 UTC · commit |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 27 out of 35 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 39 out of 60 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (1)
src/winapp-CLI/WinApp.Cli/Commands/RunCommand.cs:136
- --symbols is described as “only used with --debug-output”, but there’s no validation preventing users from passing --symbols without --debug-output (it will be silently ignored). Add an explicit check (useSymbols && !debugOutput) to return an error, or hide the option unless --debug-output is set.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…g noise - Add PdbSourceResolver to CrashDumpService that reads portable PDBs using System.Reflection.Metadata to map ClrMD stack frames to source file:line - Thread symbolSearchPaths (build output folder) through IDebugOutputService and ICrashDumpService interfaces so PDBs are found without copying - Apply source resolution to exception stacks, stack overflow detection, and all-threads detail log - Filter OutputDebugString console output to suppress OS/framework noise (WinUI, COM, DirectX, kernel traces) while logging everything to file - Filter first-chance exceptions on console to only show CLR, AV, and SOE while logging all exception codes to the debug log file Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… resolution - Show tip to re-run with --symbols when a native crash occurs without it - Update debugging.md and usage.md to document source file:line resolution from PDBs and console noise filtering behavior - Add --symbols usage example to usage.md Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…HANDLE for dump capture - Thread useSymbols parameter into LaunchViaExecutionAliasAsync so --symbols is not silently ignored when combined with --with-alias - Add PROCESS_DUP_HANDLE access right to OpenProcess call in WriteMiniDump, required by MiniDumpWithHandleData dump type Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…f stack trace When winapp (ARM64) debugs an x64 app under emulation, ClrMD cannot load the cross-architecture DAC DLL. Detect the architecture mismatch early and display a clean message pointing the user to WinDbg, instead of dumping an internal ClrDiagnosticsException stack trace. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Display debug log path when app exits normally (no crash), so users can find captured OutputDebugString messages and first-chance exceptions - Remove unused threadId parameter from WriteMiniDump — it was accepted but never used, misleading callers about its purpose Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
When a WinUI 3 app crashes during winapp run --debug-output, the previous output only showed a bare exception code and address. This PR adds automatic crash dump capture and in-process analysis using ClrMD (Microsoft.Diagnostics.Runtime) — no external tools required.
How it works
Flow:
App crashes → Write dump → ClrMD analysis → Found managed exception?
→ Yes: Show exception type, message, managed stack trace
→ No: Fall back to DbgEng native analysis (with or without symbols)
→ Terminal shows summary, full details in log file
Output layering
Terminal: Crash summary: faulting symbol, module, source file:line, compact stack (framework frames collapsed)
Log file: All OutputDebugString messages, first-chance exceptions, full thread stacks with module names
Dump file: Full memory minidump for deep analysis with WinDbg or Visual Studio
Usage Example
Related Issue
Type of Change
Checklist
Screenshots / Demo
AI Description
This PR introduces crash dump capture and automated analysis during app execution with the
--debug-outputflag. When a WinUI 3 app crashes, the tool now automatically writes a minidump and performs a managed or native analysis without needing external tools. Users can enrich native crash analysis by adding the--symbolsflag to download PDBs for better diagnostics.Usage example:
Breaking Change: None.