-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Closed
Copy link
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Description
@jszabo98 discovered the Start-ThreadJob problem in #11092; it affects ForEach-Object -Parallel as well
Unlike #11092, it doesn't seem to be related to output formatting data per se, but to the VT escape sequences created to highlight the matching part of a line, given that the problem goes away when you add -NoEmphasis - even though the tests use -Raw for direct [string] output, in which case -NoEmphasis should have no effect, given that -Raw doesn't perform highlighting.
Steps to reproduce
# Adding -NoEmphasis to Select-String makes the problem go away.
Start-ThreadJob { 'hi' | Select-String hi -Raw } | Receive-Job -Wait -AutoRemoveJob | Should -be hi
'hi' | ForEach-Object -parallel { $_ | Select-String hi -Raw } | Should -Be hiExpected behavior
Both tests should pass.
Actual behavior
Both tests emit an error message and fail:
Select-String: Object reference not set to an instance of an object.
...
^ Expected 'hi', but got $null.
Environment data
PowerShell Core 7.0.0-preview.6
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime