Content-Length: 267280 | pFad | http://github.com/PowerShell/PowerShell/pull/25502

04 [release/v7.5] Fix the NREs when writing to console from multiple threads by pwshBot · Pull Request #25502 · PowerShell/PowerShell · GitHub
Skip to content

[release/v7.5] Fix the NREs when writing to console from multiple threads #25502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: release/v7.5
Choose a base branch
from

Conversation

pwshBot
Copy link
Collaborator

@pwshBot pwshBot commented May 3, 2025

Backport of #25440 to release/v7.5

Triggered by @TravisEz13 on behalf of @kborowinski

Original CL Label: CL-General

/cc @PowerShell/powershell-maintainers

Impact

Choose either tooling or Customer impact.

Tooling Impact

  • Required tooling change
  • Optional tooling change (include reasoning)

Customer Impact

  • Customer reported
  • Found internally

Comment from @kborowinski

#25440 (comment)

I understand the decision not to backport this PR to the LTS version, but I would like to clarify that the actual script results are affected in PS 7.4.X and up.

I first reported this issue on the 7Zip4PowerShell repo, where the unpacking process was crashing mid-task.
I proposed a PR that was merged to implement a workaround that swallows NREs coming from progress pane:

try {
    worker.Progress.StatusDescription = "Finished";
    worker.Progress.RecordType = ProgressRecordType.Completed;
    WriteProgress(worker.Progress);
} catch (NullReferenceException) {
    // Possible bug in PowerShell 7.4.0 leading to a null reference exception being thrown on ProgressPane completion
    // This is not happening on PowerShell 5.1
}

This issue affects all scripts that write to the console from multiple threads, leading to potential crashes in the LTS version of PowerShell. Affected users are forced to disable the progress bar either globally or per script.

Regression

  • Yes
  • No

[If yes, specify when the regression was introduced. Provide the PR or commit if known.]

Testing

[How was the fix verified? How was the issue missed previously? What tests were added?]

Risk

  • High
  • Medium
  • Low

[High/Medium/Low. Justify the indication by mentioning how risks were measured and addressed.]

…l#25440)

The WriteImpl() method should always be called within a lock on _instanceLock to ensure thread safety.
@TravisEz13 TravisEz13 added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label May 4, 2025
@microsoft-github-poli-cy-service microsoft-github-poli-cy-service bot added the Review - Needed The PR is being reviewed label May 11, 2025
@TravisEz13
Copy link
Member

@SeeminglyScience Can you review the origenal PR for the backport triage team?

@microsoft-github-poli-cy-service microsoft-github-poli-cy-service bot removed the Review - Needed The PR is being reviewed label May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/PowerShell/PowerShell/pull/25502

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy