Skip to content

Wrong description #4093

Closed
Closed

Description

@bjoernf73

The documentation states:

"The third command writes a debug message. It uses the Debug common parameter to override the value of $DebugPreference and to display the debug messages resulting from this command.
As a result, even though the value of $DebugPreference is SilentlyContinue, the debug message appears.".

This is a bit misleading. The debug switch actually changes the $DebugPreference within the context of that command. Also to be seen in the following example:

function testf {
[cmdletbinding()]
param()
Write-Host "DebugPreference is $DebugPreference"
}

PS C:> testf
DebugPreference is SilentlyContinue
PS C:> testf -debug
DebugPreference is Inquire
PS C:>

Moreover, as seen in the above example, the -debug switch doesn't just "display" the message as is stated in the helptext - it sets $DebugPreference to "Inquire" (for some reason totally different from the verbose switch, which would set it to "continue"), and halts execution to inquire if execution should continue - which is very different when used in scripts, for example.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Activity

  1. added a commit that references this issue on Aug 26, 2019
    0ac3ae8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-debuggingArea - Debugging servicesarea-utilityArea - Microsoft.PowerShell.Utility module

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions