Recently I came across this exception while working on a making a script PowerShell v2 compatible:
Exception calling "Serialize" with "1" argument(s): "A circular reference was detected while serializing an object of type 'System.Management.Automation.PSParameterizedProperty'."
It turns out that this isn’t a “data” issue as most of the stackoverflow answers seem indicate. Well, it probably is under the hood, but all that was required to fix the problem was to omit the
return statement from my
getReturnValue function. Problem fixed: