Use of System.IO.Pipes causes slow/strange behavior

Hey, folks! Having a weird problem, here…can’t narrow it down.

Here’s a sample project that opens a .NET Console Application process, opens a pipe, and sends a simple string through to the other end. It works! Sort of.

There seems to be some weird, jerky behavior going on. Attempting to drag the window is stuttery, and it seems to freeze for a second or two reasonably frequently before fixing itself. I don’t know what’s causing the problem…nearly identical code running outside of Unity, in another standard .NET Console Application, works perfectly fine.

Anyone know what’s up?

Well, just want to state that even though I’m not sure why that hurt performance so badly, moving the ss.ReadStream() and all other relevant Pipe calls to a separate thread fixed the problem. I now have a nice, invisible process running alongside Unity, picking up voice commands from the .NET implementation of System.Speech and piping them in. Awesome.