As someone else has spotted, there is a bug where _sortOutput
will be null. But regardless of that, you are completely correct: e.Data
can and will be null!
In fact, your handler should always get called with e.Data
equal to null when the AsyncStreamReader that is doing the calling reaches EOF of the standard output that is being redirected - which will happen when the process you are running exits. Unless, of course, you deregister your OutputDataReceived event handler first, or cancel asynchronous output redirection.