Skip to content

Powershell 7 Preview 5 | Select-String -Pattern crashes when executed in ForEach-Object -Parallel #11052

@danielealbano

Description

@danielealbano

Steps to reproduce

0..0 | ForEach-Object -Parallel {
    $regExpRule = "this (.+) test"
    "it looks like this is a test!" | Select-String -Pattern $regExpRule
}

Expected behavior

Should print out

it looks like this is a test!

Actual behavior

The executed code crashes with the following error

Select-String:
Line |
   3 | "it looks like this is a test!" | Select-String -Pattern $regExpRule
     |                                   ^ Object reference not set to an instance of an object.

Environment data


Name                           Value
----                           -----
PSVersion                      7.0.0-preview.5
PSEdition                      Core
GitCommitId                    7.0.0-preview.5
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.WG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions