From 44b9fd75a1277012a40fb326dfa57b0e8793f730 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Mon, 28 Aug 2023 13:18:55 -0700 Subject: [PATCH 1/2] Add name to contributors list --- CONTRIBUTING.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c326deeb..2591dab2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -422,7 +422,7 @@ Pester can also be used to test code-coverage, like so: ```powershell $pesterConfig = New-PesterConfiguration -$pesterConfig.CodeCoverage.Path = @("$root\GitHubLabels.ps1") +$pesterConfig.CodeCoverage.Path = @("$root\GitHubLabels.ps1") $pesterConfig.CodeCoverage.Enabled = $true Invoke-Pester -Configuration $pesterConfig @@ -435,7 +435,7 @@ The code-coverage object can be captured and interacted with, like so: ```powershell $pesterConfig = New-PesterConfiguration -$pesterConfig.CodeCoverage.Path = @("$root\GitHubLabels.ps1") +$pesterConfig.CodeCoverage.Path = @("$root\GitHubLabels.ps1") $pesterConfig.CodeCoverage.Enabled = $true $pesterConfig.Run.PassThru = $true @@ -625,6 +625,7 @@ Thank you to all of our contributors, no matter how big or small the contributio - **[Neil White (@variableresistor)](https://github.com/variableresistor)** - **[Mark Curole(@tigerfansga)](https://github.com/tigerfansga)** - **[Jason Vercellone(@vercellone)](https://github.com/vercellone)** +- **[Andy Jordan (@andyleejordan)](https://github.com/andyleejordan)** ---------- From a59bbc24c28d27ce5e01c34d6bdc1cbba88e3713 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Mon, 28 Aug 2023 12:19:58 -0700 Subject: [PATCH 2/2] Replace `BinaryFormatter` with `PSSerializer` Since the former has been removed from PowerShell 7.4 (because it was removed from .NET 7) and the latter can accomplish the same thing. The default depth is 1, so we need to specify. Best I could find was that the prior implementation defaulted to a depth of 64, so we're going with that. --- Helpers.ps1 | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Helpers.ps1 b/Helpers.ps1 index d915140c..3a3023cd 100644 --- a/Helpers.ps1 +++ b/Helpers.ps1 @@ -394,14 +394,8 @@ function DeepCopy-Object [PSCustomObject] $InputObject ) - $memoryStream = New-Object System.IO.MemoryStream - $binaryFormatter = New-Object System.Runtime.Serialization.Formatters.Binary.BinaryFormatter - $binaryFormatter.Serialize($memoryStream, $InputObject) - $memoryStream.Position = 0 - $DeepCopiedObject = $binaryFormatter.Deserialize($memoryStream) - $memoryStream.Close() - - return $DeepCopiedObject + $serialData = [System.Management.Automation.PSSerializer]::Serialize($InputObject, 64) + return [System.Management.Automation.PSSerializer]::Deserialize($serialData) } function New-TemporaryDirectory