Skip to content

Replace BinaryFormatter with PSSerializer #415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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)**

----------

Expand Down
10 changes: 2 additions & 8 deletions Helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down