Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix the null-reference exception when running Debug-Job on a thread job#3957

Merged
daxian-dbw merged 1 commit into
PowerShell:masterPowerShell/PSReadLine:masterfrom
daxian-dbw:null-exdaxian-dbw/PSReadLine:null-exCopy head branch name to clipboard
Feb 26, 2024
Merged

Fix the null-reference exception when running Debug-Job on a thread job#3957
daxian-dbw merged 1 commit into
PowerShell:masterPowerShell/PSReadLine:masterfrom
daxian-dbw:null-exdaxian-dbw/PSReadLine:null-exCopy head branch name to clipboard

Conversation

@daxian-dbw

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

Copy link
Copy Markdown
Member

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

Comment thread PSReadLine/Prediction.cs
@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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.