microsoft / StoreBroker

A PowerShell module that leverages the Windows Store Submission API to allow easy automation of application submissions to the Windows Store. The master branch is stable and the v2 branch is under active development.
Other
97 stars 40 forks source link

Reintroduce deep copy fix #264

Open joseartrivera opened 3 months ago

joseartrivera commented 3 months ago

In #260 we used DeepCopy-Object to create a copy of hashtables and pscustomobjects. This caused enums to be treated as PSCustomObjects and would later throw exceptions when Convert-EnumToString would call the copy() function on it.

My initial thought to fix was to call Convert-EnumToString before doing the deep-copy. However I noticed Convert-EnumToString is accomplishing the same thing we want to do and instead of using DeepCopy it does a shallow copy with Copy() and Clone() and then recursively makes more shallow copies.

We can modify our original solution to do the same thing since we are also calling child objects recursively if we plan on modifying them.