Prerequisites
Steps to reproduce
Minimal reproducible example for .NET 9 with Microsoft.PowerShell.SDK 7.5.4:
using var pool = RunspaceFactory.CreateRunspacePool(CreateSessionState());
pool.SetMinRunspaces(1);
pool.SetMaxRunspaces(5);
pool.Open();
using var ps = PowerShell.Create();
ps.RunspacePool = pool;
ps.AddScript("Write-Output");
ps.AddStatement();
ps.AddScript("Write-Output");
var result = await ps.InvokeAsync();
Based on the documentation for the InvokeAsync method with no arguments, it doesn't require any setup and should work fine. In fact, if there's only one statement, it works just fine.
Interestingly, the synchronous Invoke method doesn't have any problems with multiple statements and works as expected.
Expected behavior
I would expect it to work similarly to the synchronous `Invoke()` method.
Actual behavior
The call to `InvokeAsync` hangs forever.
Error details
Environment data
Name Value
---- -----
PSVersion 7.5.4
PSEdition Core
GitCommitId 7.5.4
OS Ubuntu 24.04.1 LTS
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Prerequisites
Steps to reproduce
Minimal reproducible example for .NET 9 with Microsoft.PowerShell.SDK 7.5.4:
Based on the documentation for the
InvokeAsyncmethod with no arguments, it doesn't require any setup and should work fine. In fact, if there's only one statement, it works just fine.Interestingly, the synchronous
Invokemethod doesn't have any problems with multiple statements and works as expected.Expected behavior
I would expect it to work similarly to the synchronous `Invoke()` method.Actual behavior
The call to `InvokeAsync` hangs forever.Error details
There are no errors.Environment data
Visuals
No response