GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Debug parameter now sets debugpreference to continue by KirkMunro · Pull Request #8195 · PowerShell/PowerShell

Conversation

@KirkMunro

@KirkMunro Kirk Munro (KirkMunro) commented Nov 6, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

PR Summary

This is bound to generate some discussion because it is a breaking change (but not to scripts -- it breaks current interactive behavior). With this PR in place, users who invoke a command with -Debug will no longer be presented with a prompt asking them if they want to enter a nested prompt, continue execution, or halt execution entirely. Instead, any messages sent to the debug stream will simply be sent to the debug stream and the script will continue execution. That is why this is identified as a breaking change, but only for interactive use.

As described in #7122, the current -Debug behavior dates back to PowerShell v1 and hasn't been useful since the debugger was introduced in PowerShell 2. It's time this functionality be made useful again, for all of the reasons identified in #7122 (so that we can actually have debug output from specific commands show up when they are invoked with -Debug without having to go through a bunch of unwanted prompts). See the details in the bug report to understand why this change is desired by members of the PowerShell Community.

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Change is not breaking
  • Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
  • This PR is ready to merge and is not Work in Progress.
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready.
  • User-facing changes
    • Not Applicable
    • OR
    • User-facing Documentation needed
      • Issue filed - Issue link: Document changes to -Debug common parameter MicrosoftDocs/PowerShell-Docs#3255
  • Testing - New and feature
    • Not Applicable or can only be tested interactively
    • OR
    • Make sure you've added a new test if existing tests do not effectively test the code changed
      • Add [feature] if the change is significant or affects feature tests

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rkeithhill and vexx32 reacted with thumbs up emoji vexx32 and KevinMarquette reacted with hooray emoji
All reactions
  • 👍 2 reactions
  • 🎉 2 reactions
@KirkMunro
-debug now sets debugpreference to continue
5965613
@KirkMunro
Kirk Munro (KirkMunro) requested review from Bruce Payette (BrucePay) and Dongbo Wang (daxian-dbw) as code owners November 6, 2018 18:20
@KirkMunro Kirk Munro (KirkMunro) mentioned this pull request Nov 6, 2018
Document changes to -Debug common parameter MicrosoftDocs/PowerShell-Docs#3255
Closed
2 of 7 tasks
PaulHigin
Paul Higinbotham (PaulHigin) suggested changes Nov 6, 2018
View reviewed changes

@PaulHigin Paul Higinbotham (PaulHigin) left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fully agree with this change. To me -Debug is much more useful as a data stream rather than a prompt.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/System.Management.Automation/engine/MshCommandRuntime.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Kirk Munro (KirkMunro) added 2 commits November 6, 2018 21:22
@KirkMunro
Changes requested in code review
d1de86c
@KirkMunro
CodeFactor changes
175e7ca
@iSazonov

Ilya (iSazonov) commented Nov 7, 2018

Copy link
Copy Markdown
Collaborator

PowerShell-CI-Windows temporary failed. Restart it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov Ilya (iSazonov) self-assigned this Nov 7, 2018
PaulHigin
Paul Higinbotham (PaulHigin) approved these changes Nov 7, 2018
View reviewed changes
@SteveL-MSFT Steve Lee (SteveL-MSFT) added Review - Committee The PR/Issue needs a review from the PowerShell Committee Breaking-Change breaking change that may affect users labels Nov 8, 2018
@KirkMunro Kirk Munro (KirkMunro) mentioned this pull request Nov 15, 2018
Break action preference #8205
Merged
7 of 11 tasks
@KirkMunro
Merge branch 'master' into debugpreference-continue
2f75da3
@iSazonov Ilya (iSazonov) added the CL-Engine Indicates that a PR should be marked as an engine change in the Change Log label Nov 16, 2018
@SteveL-MSFT

Steve Lee (SteveL-MSFT) commented Nov 28, 2018

Copy link
Copy Markdown
Member

@PowerShell/powershell-committee the current PR precludes the ability to opt into the current behavior to use Inquire. We agree that the default can be Continue, but we still need a way to allow users to use Inquire. Suggestion is to add -DebugAction to allow going back to current behavior for a specific cmdlet, however, that can be deferred until someone needs it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveL-MSFT Steve Lee (SteveL-MSFT) added Committee-Reviewed PS-Committee has reviewed this and made a decision and removed Review - Committee The PR/Issue needs a review from the PowerShell Committee labels Nov 28, 2018
@KirkMunro

Kirk Munro (KirkMunro) commented Nov 29, 2018

Copy link
Copy Markdown
Contributor Author

If you happen to get such a request (someone asking for Inquire support), please tag me, I'd love to learn why someone wants that support.

PaulHigin and dragonwolf83 reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

SteveL-MSFT
Steve Lee (SteveL-MSFT) approved these changes Nov 30, 2018
View reviewed changes
@iSazonov Ilya (iSazonov) added the CL-BreakingChange Indicates that a PR should be marked as a breaking change in the Change Log label Nov 30, 2018
@iSazonov

Ilya (iSazonov) commented Nov 30, 2018

Copy link
Copy Markdown
Collaborator

Is the PR ready to merge? If so Kirk Munro (@KirkMunro) please update the PR description (breaking change is not mentioned).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@KirkMunro

Kirk Munro (KirkMunro) commented Nov 30, 2018

Copy link
Copy Markdown
Contributor Author

Ilya (@iSazonov): It is ready to merge, and I added more descriptive details to the first paragraph in the description to identify what would be breaking.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov Ilya (iSazonov) changed the title -debug now sets debugpreference to continue Debug parameter now sets debugpreference to continue Nov 30, 2018
@iSazonov
Ilya (iSazonov) merged commit e721f7b into PowerShell:master Nov 30, 2018
@iSazonov

Ilya (iSazonov) commented Nov 30, 2018

Copy link
Copy Markdown
Collaborator

Kirk Munro (@KirkMunro) Thanks for the great contribution!

KirkMunro reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@KirkMunro
Kirk Munro (KirkMunro) deleted the debugpreference-continue branch January 7, 2019 21:22
@KirkMunro Kirk Munro (KirkMunro) mentioned this pull request May 9, 2019
Need straightforward way to honor the caller's preference-variable values / inherited common parameters in functions defined in script modules #4568
Open
@KirkMunro Kirk Munro (KirkMunro) mentioned this pull request Oct 11, 2019
Add VerboseAction, DebugAction, ProgressAction, VerboseVariable, DebugVariable, and ProgressVariable common parameters #10238
Closed
10 of 14 tasks
@rjmholt Rob Holt (rjmholt) mentioned this pull request Oct 23, 2019
Change in behaviour of -Debug common parameter #10873
Closed
@KirkMunro Kirk Munro (KirkMunro) mentioned this pull request Sep 14, 2020
Binary cmdlets spam the information stream inappropriately and logs sensitive information to that stream microsoftgraph/msgraph-sdk-powershell#373
Closed
@JeremyTBradshaw

JeremyTBradshaw commented Dec 3, 2020

Copy link
Copy Markdown

If you happen to get such a request (someone asking for Inquire support), please tag me, I'd love to learn why someone wants that support.

I am a little late jumping to PowerShell 7.1. Recently started to while I am using MS Graph and EWS Managed API and have no need for Windows PowerShell when doing so. I was caught off guard by this change, and am very used to -Debug resulting in Inquire. I found debugging this way, way easier than anything else. Debugging in VS Code seemed difficult and so I stuck with -Debug = Inquire.

I'm not necessarily opposed to the new way, but I would like to know where is some decent documentation on how to debug as easily. I really like to Suspend, jump in and investigate. It's how I hone in all my scripts and flush out errors. I don't like to just see streams of info blowing by, so really need that Suspend capability.

Please do share if you can. I'll also start researching on the topic. This is a doozy of a change indeed. If it means debugging the old way in a regular PowerShell console isn't possible, ouch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JeremyTBradshaw

JeremyTBradshaw commented Dec 3, 2020

Copy link
Copy Markdown

Actually, you know it's fine. I will just get used to it. I am a little lost on debugging in general so that's on me. I see how -ErrorAction Break is essentially what I need for replacing the older -Debug = Inquire in Windows PowerShell.

Using ErrorAction Break for the first time, the top 1/2 of the instructions were covered over by my frozen Write-Progress. And scrolling up, all the text is garbled. Quickly put my tail between my legs and just went back to Windows PowerShell. Saving this bit of learning for a future date.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Samuli3682

Samuli3682 commented Dec 3, 2020 via email •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Jeah...i am totally out of what i'm trying to do...just want working twrp. to my mate Pro 10bla-l29.... to 3. jouluk. 2020 klo 5.31 Jeremy <[email protected]> kirjoitti:
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@KirkMunro

Kirk Munro (KirkMunro) commented Dec 3, 2020

Copy link
Copy Markdown
Contributor Author

Hey JeremyTBradshaw, thanks for responding back. I was really curious if there would be resistance among some folk, and the fact that you're responding rather than just silently complaining is very helpful.

I'm happy to help you out with this, either via back-and-forth texts, or a call on Microsoft Teams where we can screenshare and I could show you the ropes of the debugger. That would be helpful for me as well, to learn how you would like to use the debugger, and make sure that your needs are covered. Maybe the outcome of this will be a document describing what you're looking for: how to transition from -Debug's Inquire capability to the using the full power of the debugger without losing your mind in the process.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@KirkMunro

Kirk Munro (KirkMunro) commented Dec 3, 2020

Copy link
Copy Markdown
Contributor Author

Using ErrorAction Break for the first time, the top 1/2 of the instructions were covered over by my frozen Write-Progress. And scrolling up, all the text is garbled. Quickly put my tail between my legs and just went back to Windows PowerShell. Saving this bit of learning for a future date.

For this, might I suggest setting $ProgressPreference = 'SilentlyContinue', and then running your script with -ErrorAction Break? That would prevent the progress window from appearing, which should help what you just tried a little. Anyway, if you want to do a call to discuss this and more, I'll be able to fast forward your learning quite a bit.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@KirkMunro

Kirk Munro (KirkMunro) commented Dec 3, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

If it means debugging the old way in a regular PowerShell console isn't possible, ouch.

One last thing JeremyTBradshaw: I do almost all of my debugging in a regular PowerShell console. Always have. Only rarely will I debug in an IDE like PowerShell ISE or VS Code. All to say, debugging in a regular PowerShell console works wonderfully.

You can also do old-school debugging in PowerShell 7 anytime you like. Simply set $DebugPreference = 'Inquire' and then run your script without -Debug, and when you do, you'll get the prompts that you are used to; however, it would be beneficial to learn the debugger itself and to understand how to leverage what it can do for you -- you'll be more efficient when you need to debug scripts as a result.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JeremyTBradshaw

JeremyTBradshaw commented Dec 3, 2020

Copy link
Copy Markdown

If it means debugging the old way in a regular PowerShell console isn't possible, ouch.

One last thing JeremyTBradshaw: I do almost all of my debugging in a regular PowerShell console. Always have. Only rarely will I debug in an IDE like PowerShell ISE or VS Code. All to say, debugging in a regular PowerShell console works wonderfully.

You can also do old-school debugging in PowerShell 7 anytime you like. Simply set $DebugPreference = 'Inquire' and then run your script without -Debug, and when you do, you'll get the prompts that you are used to; however, it would be beneficial to learn the debugger itself and to understand how to leverage what it can do for you -- you'll be more efficient when you need to debug scripts as a result.

Thanks for this. I would take you up on the Teams meeting offer if it still stands. Not sure when you had in mind but I've just exposed my email address on my GitHub profile and my tomorrow is currently open so if that works, that'd be great. I should be quick to pick it up, so really it won't be long, and I can quickly show you the way I've been using -Debug. The short version is that I commonly place Write-Debug's in my code wherever I'd like to jump in to troubleshoot or test, and then run with -Debug. Whereas you're confirming you do your proper debugging in the console, that is good to hear, so again, look forward to the chance to get a quick rundown on this.

Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@KirkMunro

Kirk Munro (KirkMunro) commented Dec 3, 2020

Copy link
Copy Markdown
Contributor Author

JeremyTBradshaw: Responded via the email address you shared, and we can work out a time through email.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@KirkMunro @iSazonov
Debug parameter now sets debugpreference to continue (PowerShell#8195)
b2adcc8
With this commit, users who invoke a command with -Debug will no longer be presented with a prompt asking them if they want to enter a nested prompt, continue execution, or halt execution entirely. Instead, any messages sent to the debug stream will simply be sent to the debug stream and the script will continue execution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@SteveL-MSFT Steve Lee (SteveL-MSFT) SteveL-MSFT approved these changes
@BrucePay Bruce Payette (BrucePay) Awaiting requested review from BrucePay
@daxian-dbw Dongbo Wang (daxian-dbw) Awaiting requested review from daxian-dbw
+1 more reviewer
@PaulHigin Paul Higinbotham (PaulHigin) PaulHigin approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@iSazonov Ilya (iSazonov)

Labels

Breaking-Change breaking change that may affect users CL-BreakingChange Indicates that a PR should be marked as a breaking change in the Change Log CL-Engine Indicates that a PR should be marked as an engine change in the Change Log Committee-Reviewed PS-Committee has reviewed this and made a decision

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@KirkMunro @iSazonov @SteveL-MSFT @JeremyTBradshaw @Samuli3682 @PaulHigin
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.