May the debugger be with you, 2026 edition - Manfred Wallner - PSConfEU 2026

Опубликовано: 27 Июль 2026
на канале: PowerShell Conference EU
233
6

PowerShell Conference EU
June 1-4, 2026
Dorint Pallas Wiesbaden
https://github.com/psconfeu/2026 (slides, code)

This session was a follow-along lecture on PowerShell debugging. Manfred Wallner introduced the plan for the session: first a short overview of debugging concepts, then examples covering debugging the current script, attaching to another process, debugging a PowerShell service running in Docker, and using trap blocks for post-mortem crash handling.

Manfred began by explaining what debugging is and why it is used to understand program behaviour and troubleshoot incorrect results. They compared this with print line debugging, structured logging and other ways of recording execution, while noting that these approaches still require reconstructing what happened after the fact.

They then showed the built-in PowerShell debugger and the debugging features in VS Code. The session covered stepping over and stepping into code, breakpoints, conditional breakpoints, the variables view, the watch window, the call stack, and the breakpoint management view. They also noted that VS Code is currently the preferred experience for PowerShell debugging.

The first demo used a simple script to show how to pause execution with `Wait-Debugger`, step through a loop, and inspect values while the script runs. The speaker demonstrated how modifying values in the debugger session affects execution, and how stepping into a function helps identify where a condition is or is not being evaluated as expected.

The second example attached the debugger to a running PowerShell web service created with Border. The speaker used VS Code launch configurations to attach to the correct process and runspace, then set breakpoints inside endpoint code to inspect a shopping-cart calculation. They used a conditional breakpoint to stop only on premium items and found a discount calculation issue caused by converting a value to an integer.

The third example showed debugging a PowerShell script running inside a Docker container. Using VS Code’s container tooling, the speaker attached to the container, opened the script, and stepped through an endpoint that called the `fortune` command. They inspected variables, corrected a path issue for the executable, and then fixed a second bug where only one line of output was returned.

The final example covered `trap` as a global error handler for graceful crash handling. The speaker showed a crash-dump script that exports the error record, call stack, variables and system information so the state can be reconstructed later. They then used the exported data to inspect the failure, identify a divide-by-zero issue, and fix another problem involving pipeline input being passed element by element instead of as a collection.

Chapters:
00:00:00 may the debugger be with you, 2026 edition - Manfred Wallner - PSConfEU 2026
00:00:54 Overview and Setup
00:04:46 Why Debugging Matters
00:07:43 Breakpoints and VS Code
00:11:05 Exploring Debugger Windows
00:15:07 First Debugging Demo
00:25:54 Webshop Service Scenario
00:34:30 Attaching to the Service
00:54:14 Symlink Path Debugging
01:04:24 Docker Debugging Example
01:09:25 Inspecting the Container
01:15:40 Debugging Inside Container
01:22:32 Trap Handlers and Crashes
01:26:51 Saving Crash State
01:34:10 Replaying the Error
01:38:37 More Examples and Wrap-Up
01:40:28 Feedback and Questions