To reproduce:
- Implement a basic cmdlet (or hack one that already exists)
- As the first statement in its implementation call
Host.UI.Write("anything")
- Call the cmdlet
An out of range exception is thrown, due to the array count check here becoming index -1 if the Output has nothing in it yet.
Edge case? Yes. And it was because I was using it wrong anyway ;)