Skip to content

Conversation

@daxian-dbw
Copy link
Member

@daxian-dbw daxian-dbw commented Feb 26, 2024

PR Summary

Fix #3954

The $Host.Runspace is null when PSConsoleHostReadLine is invoked while debugging a thread job.
This is because a thread job uses the default host, which always has value null for $Host.Runspace.
We set the current path to be null when either runspace or engineIntrinsics is null.

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Make sure you've added one or more new tests
  • Make sure you've tested these changes in terminals that PowerShell is commonly used in (i.e. conhost.exe, Windows Terminal, Visual Studio Code Integrated Terminal, etc.)
  • User-facing changes
    • Not Applicable
    • OR
    • Documentation needed at PowerShell-Docs
      • Doc Issue filed:
Microsoft Reviewers: Open in CodeFlow

@daxian-dbw daxian-dbw merged commit ce2302c into PowerShell:master Feb 26, 2024
@daxian-dbw daxian-dbw deleted the null-ex branch February 26, 2024 21:29
@daxian-dbw daxian-dbw added Backport-2.3.x-Consider To be backported to v2.3.x. Backport-2.3.x-Done Finished cherry-picking the commit to the release branch. and removed Backport-2.3.x-Consider To be backported to v2.3.x. labels Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport-2.3.x-Done Finished cherry-picking the commit to the release branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using Debug-Job to debug a background / thread job causes a crash

2 participants