internal ActionEntryExternalHelper(ActionEntry entry, MethodInfo methodInfo) { System.Diagnostics.Debug.Assert( entry != null, "Missing parameter 'entry'" ); System.Diagnostics.Debug.Assert( methodInfo != null, "Missing parameter 'methodInfo'" ); System.Diagnostics.Debug.Assert( entry != null, "Missing parameter 'entry'" ); Entry = entry; CallerProcess = Process.GetCurrentProcess(); var procInfo = new System.Diagnostics.ProcessStartInfo(); procInfo.UseShellExecute = false; //procInfo.RedirectStandardError = true; procInfo.RedirectStandardOutput = true; procInfo.RedirectStandardInput = true; procInfo.WorkingDirectory = Environment.CurrentDirectory; procInfo.FileName = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName.Replace( ".vshost"/*c.f. VisualStudio debugger*/, "" ); procInfo.Arguments = ARGUMENT; procInfo.Verb = "runas"; Process = new System.Diagnostics.Process(); Process.StartInfo = procInfo; Process.OutputDataReceived += (sender,args)=>entry.ThreadDispatch( ()=>Process_OutputDataReceived(args.Data) ); var rc = Process.Start(); System.Diagnostics.Debug.Assert( rc == true, "Process.Start() returned false" ); StreamOut = Process.StandardInput; //StreamIn = Process.StandardOutput; <= Using async reads with BeginOutputReadLine() instead Process.BeginOutputReadLine(); // Send the method to execute var msg = new Dictionary<string,object>(); msg[ MSG_METHODTYPE ] = methodInfo.DeclaringType.AssemblyQualifiedName; msg[ MSG_METHODNAME ] = methodInfo.Name; SendMessage( msg ); }