Commit eb21735
committed
fix: PowerShell.Create(Runspace) has no such overload on PS 5.1
[System.Management.Automation.PowerShell]::Create(Runspace) doesn't
exist as an overload in Windows PowerShell 5.1's System.Management.
Automation (v3.0.0.0, GAC-loaded) -- only Create(), Create(RunspaceMode),
and Create(InitialSessionState) are available there. Calling it with a
Runspace argument throws:
MethodException: Cannot find an overload for "Create" and the
argument count: "1".
Split into Create() followed by assigning the writable Runspace
property instead, which works on both PS 5.1 and 7+.
Fixes both call sites (New-KoanRunspace and Invoke-Koan) plus the
test file's own use of the same broken pattern.
Verified locally: New-KoanRunspace.Tests.ps1 + Invoke-Koan.Tests.ps1
pass under both powershell.exe 5.1 and pwsh 7.1 parent 25c9faf commit eb21735
3 files changed
Lines changed: 6 additions & 3 deletions
File tree
- PSKoans/Private
- Tests/Functions/Private
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
0 commit comments