Skip to content

Commit f8cace4

Browse files
Merge pull request #702 from PowershellFrameworkCollective/development
1.13.416
2 parents 8f801a5 + 5fa7d55 commit f8cace4

File tree

8 files changed

+27
-6
lines changed

8 files changed

+27
-6
lines changed

PSFramework/PSFramework.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
RootModule = 'PSFramework.psm1'
55

66
# Version number of this module.
7-
ModuleVersion = '1.13.414'
7+
ModuleVersion = '1.13.416'
88

99
# ID used to uniquely identify this module
1010
GUID = '8028b914-132b-431f-baa9-94a6952f21ff'

PSFramework/bin/PSFramework.dll

0 Bytes
Binary file not shown.

PSFramework/bin/PSFramework.pdb

0 Bytes
Binary file not shown.

PSFramework/changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG
22

3+
## 1.13.416 (2025-10-22)
4+
5+
- Fix: Invoke-PSFRunspace - errors incorrectly show PSFramework error, rather than actual errors.
6+
- Fix: Invoke-PSFRunspace - variables are not created correctly in the background runspace
7+
38
## 1.13.414 (2025-10-14)
49

510
- Upd: Wait-PSFRunspaceWorkflow - adding ProgressBar with `-ShowProgress` (#698 | @fslef)

build/vsts-build.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ if ($Build) {
4646

4747
# Prepare publish folder
4848
Write-Host "Creating and populating publishing directory"
49+
if (Test-Path -Path (Join-Path -Path $WorkingDirectory -ChildPath 'publish')) {
50+
Remove-Item -Path (Join-Path -Path $WorkingDirectory -ChildPath 'publish') -Recurse -Force
51+
}
4952
$publishDir = New-Item -Path $WorkingDirectory -Name publish -ItemType Directory -Force
5053
Copy-Item -Path "$($WorkingDirectory)\PSFramework" -Destination $publishDir.FullName -Recurse -Force
5154

library/PSFramework/Runspace/RunspaceResult.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
using PSFramework.Logging;
2+
using System;
23
using System.Collections.Generic;
34
using System.Linq;
45
using System.Management.Automation;
@@ -54,7 +55,13 @@ public RunspaceResult(object InputObject, PSDataCollection<PSObject> Output, PSD
5455
if (Streams.Warning.Count > 0)
5556
Warnings.AddRange(Streams.Warning);
5657
if (Streams.Error.Count > 0)
57-
Errors.AddRange(Streams.Error);
58+
{
59+
foreach (ErrorRecord record in Streams.Error)
60+
{
61+
try { Errors.Add(((RuntimeException)record.Exception.InnerException).ErrorRecord); }
62+
catch { Errors.Add(record); }
63+
}
64+
}
5865
#if PS4
5966
#else
6067
if (Streams.Information.Count > 0)

library/PSFramework/Runspace/RunspaceTask.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ public bool TryCollect(Cmdlet Command, bool NoStreams = false)
8888
try
8989
{
9090
foreach (ErrorRecord error in Runtime.Streams.Error)
91-
Command.WriteError(error);
91+
{
92+
try { Command.WriteError(((RuntimeException)error.Exception.InnerException).ErrorRecord); }
93+
catch { Command.WriteError(error); }
94+
}
9295
}
9396
finally
9497
{
@@ -166,7 +169,10 @@ public void Collect(Cmdlet Command, bool NoStreams = false)
166169
try
167170
{
168171
foreach (ErrorRecord error in Runtime.Streams.Error)
169-
Command.WriteError(error);
172+
{
173+
try { Command.WriteError(((RuntimeException)error.Exception.InnerException).ErrorRecord); }
174+
catch { Command.WriteError(error); }
175+
}
170176
}
171177
finally
172178
{

library/PSFramework/Runspace/RunspaceWrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public void AddVariable(string Name, object Value)
9696
/// <param name="VariableHash">Name/value map of variables to inclue</param>
9797
public void AddVariable(Hashtable VariableHash)
9898
{
99-
foreach (object key in VariableHash)
99+
foreach (object key in VariableHash.Keys)
100100
Variables[key.ToString()] = new SessionStateVariableEntry(key.ToString(), VariableHash[key], "");
101101
}
102102

0 commit comments

Comments
 (0)