From 72b2f40556c7c90736d4be4272001704b23b685d Mon Sep 17 00:00:00 2001 From: brogers5 <6869577+brogers5@users.noreply.github.com> Date: Wed, 29 Nov 2023 22:40:16 -0500 Subject: [PATCH] Reimplement RunInfo plugin's deep_clone function for PowerShell 7.4+ compatibility --- src/Plugins/RunInfo.ps1 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Plugins/RunInfo.ps1 b/src/Plugins/RunInfo.ps1 index 8ebea4d..282fd84 100644 --- a/src/Plugins/RunInfo.ps1 +++ b/src/Plugins/RunInfo.ps1 @@ -22,11 +22,8 @@ param( function deep_clone { param($DeepCopyObject) - $memStream = new-object IO.MemoryStream - $formatter = new-object Runtime.Serialization.Formatters.Binary.BinaryFormatter - $formatter.Serialize($memStream,$DeepCopyObject) - $memStream.Position=0 - $formatter.Deserialize($memStream) + $serializedObject = [System.Management.Automation.PSSerializer]::Serialize($DeepCopyObject, 32) + [System.Management.Automation.PSSerializer]::Deserialize($serializedObject) } # Runinfo must save its own run results directly in Info