Skip to content

[Regression] Difference in behavior when using Debug-Runspace from Windows PowerShell and PowerShell 7 #13567

Closed

Description

@TylerLeonhardt

Steps to reproduce

Open 2 PowerShell windows of the same version

create a file foo.ps1 that looks like this:

"hello"
Start-Sleep -Seconds 20
"boo"

In PowerShell one

PS > $pid | scb

In PowerShell two

PS > Enter-PSHostProcess -Id <PASTE>

In PowerShell one

PS > . .\foo.ps1

Hurry up and run In PowerShell two:

[Process: 2345] PS > Debug-Runspace 1

Expected behavior

This happens in Windows PowerShell

Debugging Runspace: Runspace1
To end the debugging session type the 'Detach' command at the debugger prompt, or type 'Ctrl+C' otherwise.

At C:\Users\tyleonha\Downloads\foo.ps1:3 char:1
+ "boo"
+ ~~~~~
[DBG]: [Process:30956]: [Runspace1]: PS C:\Users\tyleonha\Downloads>>

Actual behavior

This happens in PowerShell 7. Note it does not break into a debug prompt.

Debugging Runspace: Runspace1
To end the debugging session type the 'Detach' command at the debugger prompt, or type 'Ctrl+C' otherwise.


Command or script completed.
To end the debugging session type the 'Detach' command at the debugger prompt, or type 'Ctrl+C' otherwise.

Thoughts

Frankly I'm suspicious of my own PR way back when #11312 that changed this behavior. This parameter -BreakAll mentioned here:
#13527

should probably be -NoBreakAll or have some way to have it on by default and allow you to opt out. This will allow for backcompat for Windows PowerShell and the ability to toggle BreakAll.

Environment data

Name                           Value
----                           -----
GitCommitId                    7.1.0-daily.20200430
PSVersion                      7.1.0-daily.20200430
WSManStackVersion              3.0
Platform                       Unix
SerializationVersion           1.1.0.1
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
OS                             Darwin 19.6.0 Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64
PSRemotingProtocolVersion      2.3
PSEdition                      Core

Although this bug existed in 7.0...

Activity

  1. added
    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a
    on Sep 3, 2020
  2. added
    Issue-BugIssue has been identified as a bug in the product
    and removed
    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a
    on Sep 3, 2020
  3. ili101 commented on Feb 15, 2021

    @ili101

    So this is why all the 5 guides I found on how to debug runspaces didn't work for me.
    As this is a regression bug shouldn't it have higher priority?

  4. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  5. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  6. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  7. microsoft-github-policy-service commented on Nov 23, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productResolution-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