Skip to content

Need to be able to disable the debugger when the debugging is done after ActionPreference.Break is hit #10380

@daxian-dbw

Description

@daxian-dbw

This is an issue tracking the review comment of #8205 (comment), which should be fixed in the follow-up PR of #8205.

The PR #8205 introduces ActionPreference.Break, which will result breaking into the debugger (enable the debugger) when an action (e.g. ErrorAction) is hit.

-ErrorAction break will set the debugger mode to be Enabled, and after that the debugger mode will stay Enabled. That means once a ActionPreference.Break is hit, the session will never be able to run script in optimized mode anymore.
This feels like a concern to me. I can imagine one scenario where people uses -ErrorAction Break -- I don't expect an error will be thrown but want to debug in case the unexpected happens, but after debugging (quit the debugger prompt), I would like the rest of my scripts continue to run as efficient as it can (in optimized mode). That scenario will be compromised as the debugger mode will always be Enabled after the -ErrorAction Break is hit, and thus the Compiler will generated unoptimized code for the rest time of the session.

There should be a way to disable the debugger after ActionPreference.Break is hit and the debugging session is done.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or moreWG-Interactive-Debuggingdebugging PowerShell script

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions