Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PSFramework/PSFramework.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
RootModule = 'PSFramework.psm1'

# Version number of this module.
ModuleVersion = '1.13.414'
ModuleVersion = '1.13.416'

# ID used to uniquely identify this module
GUID = '8028b914-132b-431f-baa9-94a6952f21ff'
Expand Down
Binary file modified PSFramework/bin/PSFramework.dll
Binary file not shown.
Binary file modified PSFramework/bin/PSFramework.pdb
Binary file not shown.
5 changes: 5 additions & 0 deletions PSFramework/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## 1.13.416 (2025-10-22)

- Fix: Invoke-PSFRunspace - errors incorrectly show PSFramework error, rather than actual errors.
- Fix: Invoke-PSFRunspace - variables are not created correctly in the background runspace

## 1.13.414 (2025-10-14)

- Upd: Wait-PSFRunspaceWorkflow - adding ProgressBar with `-ShowProgress` (#698 | @fslef)
Expand Down
11 changes: 9 additions & 2 deletions library/PSFramework/Runspace/RunspaceResult.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using PSFramework.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
Expand Down Expand Up @@ -54,7 +55,13 @@ public RunspaceResult(object InputObject, PSDataCollection<PSObject> Output, PSD
if (Streams.Warning.Count > 0)
Warnings.AddRange(Streams.Warning);
if (Streams.Error.Count > 0)
Errors.AddRange(Streams.Error);
{
foreach (ErrorRecord record in Streams.Error)
{
try { Errors.Add(((RuntimeException)record.Exception.InnerException).ErrorRecord); }
catch { Errors.Add(record); }
}
}
#if PS4
#else
if (Streams.Information.Count > 0)
Expand Down
10 changes: 8 additions & 2 deletions library/PSFramework/Runspace/RunspaceTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ public bool TryCollect(Cmdlet Command, bool NoStreams = false)
try
{
foreach (ErrorRecord error in Runtime.Streams.Error)
Command.WriteError(error);
{
try { Command.WriteError(((RuntimeException)error.Exception.InnerException).ErrorRecord); }
catch { Command.WriteError(error); }
}
}
finally
{
Expand Down Expand Up @@ -166,7 +169,10 @@ public void Collect(Cmdlet Command, bool NoStreams = false)
try
{
foreach (ErrorRecord error in Runtime.Streams.Error)
Command.WriteError(error);
{
try { Command.WriteError(((RuntimeException)error.Exception.InnerException).ErrorRecord); }
catch { Command.WriteError(error); }
}
}
finally
{
Expand Down
2 changes: 1 addition & 1 deletion library/PSFramework/Runspace/RunspaceWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void AddVariable(string Name, object Value)
/// <param name="VariableHash">Name/value map of variables to inclue</param>
public void AddVariable(Hashtable VariableHash)
{
foreach (object key in VariableHash)
foreach (object key in VariableHash.Keys)
Variables[key.ToString()] = new SessionStateVariableEntry(key.ToString(), VariableHash[key], "");
}

Expand Down