I have a recursive script that hits a System.Management.Automation.ScriptCallDepthException
exception.
What is the call depth limit in Sitecore PowerShell and can it be overridden?
Note: Yes, I can probably refactor to avoid recursion.
EDIT: For a little clarity, it's a script to copy items from one site to another, maintaining "localized" links based on the two sites having parallel structures. The outline looks like this in pseudocode:
Queue1 = System.Collections.Generic.Queue<Sitecore.Item>
Queue2 = System.Collections.Generic.Queue<Sitecore.Item>
Function HandleQueues()
If Queue1 > 0
ProcessQueue1
HandleQueues
Else If Queue2 > 0
ProcessQueue2
HandleQueues
End if
Return
Function ProcessQueue1()
Do while Queue1 > 0
Pop Top item
Do stuff with it
Add it to Queue2
Loop
Return
Function ProcessQueue2()
Pop Top item
Do stuff with it
Find if it has links to anything that needs to go into Queue1 and add them
Return
Obviously there's plenty of scope for possible infinite loops, but I've handled pretty much all I can think of, and going through the script output I can't see any repetition. I'm pretty sure the code is logically sound, if a little brutal with building a call stack, so the question remains a technical one.