-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
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.