private void OnException(string data) { MethodInvoker method = delegate () { AddOutput(data); }; Invoke(method); }