Skip to content

NullReferenceException in ProgressPane when recovering from network interruption in WinRM remote session #17497

@pyrostew

Description

@pyrostew

Prerequisites

Steps to reproduce

Running PowerShell 7.2.4, I am performing a long running process in a WinRM Remote Session, some of the steps cause a brief network disruption that is handled gracefully in PowerShell 5.1 by trying to reconnect for 5 minutes, succeeding, and then carrying on with the rest of the process.

In PowerShell 7.2.4 this recovery process starts, but just as it recovers a null reference exception is thrown from the ProgressPane.Hide() function. this is unhandled and causes the pwsh process to exit.

I haven't had the opportunity to produce a minimal repo to reproduce this, I have however debugged this myself using the 7.2.4 tagged commit in the PowerShell repo. The exception is thrown on Line 179 of the ProgressPane.cs file which suggests that _savedRegion is null, this suggests there is some sort of threading issue.

I have Implemented a fix locally that adds lock statements to ProgressPane.Hide() and ProgressPane.Show() functions which resolves the issue. However I'm not sure if that fix would be acceptable for the project. I will link the PR here shortly.

Expected behavior

Recover from network interruption in remote sessions and continue processing.

Actual behavior

Null reference exception while recovering causing process to terminate.

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.2.4
PSEdition                      Core
GitCommitId                    7.2.4
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions