private string GetExecutionRunner(ExecutionCommand command, DotNetExecutionCommand dotcmd) { if (command is ProcessExecutionCommand processExecutionCommand && processExecutionCommand.ProcessExecutionArchitecture != ProcessExecutionArchitecture.Unspecified) { return(runtime.GetMonoExecutable(processExecutionCommand.ProcessExecutionArchitecture)); } return(runtime.GetMonoExecutableForAssembly(dotcmd.Command)); }
protected DebuggerSession Start (string test) { TargetRuntime runtime; switch (EngineId) { case "MonoDevelop.Debugger.Win32": runtime = Runtime.SystemAssemblyService.GetTargetRuntime ("MS.NET"); break; case "Mono.Debugger.Soft": runtime = Runtime.SystemAssemblyService.GetTargetRuntime ("Mono"); break; default: runtime = Runtime.SystemAssemblyService.DefaultRuntime; break; } if (runtime == null) return null; var cmd = new DotNetExecutionCommand (); cmd.Command = Path.Combine (Path.GetDirectoryName (GetType ().Assembly.Location), "MonoDevelop.Debugger.Tests.TestApp.exe"); cmd.Arguments = test; cmd.TargetRuntime = runtime; DebuggerStartInfo si = engine.CreateDebuggerStartInfo (cmd); DebuggerSession session = engine.CreateSession (); var ops = new DebuggerSessionOptions (); ops.EvaluationOptions = EvaluationOptions.DefaultOptions; ops.EvaluationOptions.EvaluationTimeout = 100000; FilePath path = Util.TestsRootDir; path = path.ParentDirectory.Combine ("src","addins","MonoDevelop.Debugger","MonoDevelop.Debugger.Tests.TestApp","Main.cs").FullPath; TextFile file = TextFile.ReadFile (path); int i = file.Text.IndexOf ("void " + test, StringComparison.Ordinal); if (i == -1) throw new Exception ("Test not found: " + test); i = file.Text.IndexOf ("/*break*/", i, StringComparison.Ordinal); if (i == -1) throw new Exception ("Break marker not found: " + test); int line, col; file.GetLineColumnFromPosition (i, out line, out col); Breakpoint bp = session.Breakpoints.Add (path, line); bp.Enabled = true; var done = new ManualResetEvent (false); session.OutputWriter = (isStderr, text) => Console.WriteLine ("PROC:" + text); session.TargetHitBreakpoint += delegate { done.Set (); }; session.Run (si, ops); if (!done.WaitOne (3000)) throw new Exception ("Timeout while waiting for initial breakpoint"); return session; }
public IProcessAsyncOperation Execute(ExecutionCommand command, IConsole console) { DotNetExecutionCommand cmd = (DotNetExecutionCommand)command; if (cmd.TargetRuntime == null) { cmd.TargetRuntime = Runtime.SystemAssemblyService.DefaultRuntime; } return(cmd.TargetRuntime.GetExecutionHandler().Execute(cmd, console)); }
public override IProcessAsyncOperation Execute(ExecutionCommand command, IConsole console) { DotNetExecutionCommand dotcmd = (DotNetExecutionCommand)command; string runtimeArgs = string.IsNullOrEmpty(dotcmd.RuntimeArguments) ? "--debug" : dotcmd.RuntimeArguments; string args = string.Format("{2} \"{0}\" {1}", dotcmd.Command, dotcmd.Arguments, runtimeArgs); NativeExecutionCommand cmd = new NativeExecutionCommand(monoPath, args, dotcmd.WorkingDirectory, dotcmd.EnvironmentVariables); return(base.Execute(cmd, console)); }
public IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console) { var config = ((PythonExecutionCommand)command).Configuration; var runtime = (IronPythonRuntime)config.Runtime; var args = runtime.GetArguments (config); string dir = Path.GetFullPath (config.ParentItem.BaseDirectory); var cmd = new DotNetExecutionCommand (runtime.Path, String.Join (" ", args), dir, config.EnvironmentVariables); return cmd.TargetRuntime.GetExecutionHandler ().Execute (cmd, console); }
public void Start() { lock (this) { if (starting) { return; } starting = true; exitRequestEvent.Reset(); RemotingService.RegisterRemotingChannel(); BinaryFormatter bf = new BinaryFormatter(); ObjRef oref = RemotingServices.Marshal(this); MemoryStream ms = new MemoryStream(); bf.Serialize(ms, oref); string sref = Convert.ToBase64String(ms.ToArray()); string tmpFile = null; if (executionHandlerFactory == null) { executionHandlerFactory = Runtime.SystemAssemblyService.CurrentRuntime.GetExecutionHandler(); } try { string location = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); location = Path.Combine(location, "mdhost.exe"); ProcessHostConsole cons = new ProcessHostConsole(); tmpFile = Path.GetTempFileName(); File.WriteAllText(tmpFile, sref + "\n" + Process.GetCurrentProcess().Id + "\n"); string arguments = string.Format("{0} \"{1}\"", id, tmpFile); DotNetExecutionCommand cmd = new DotNetExecutionCommand(location, arguments, AppDomain.CurrentDomain.BaseDirectory); cmd.DebugMode = isDebugMode; process = executionHandlerFactory.Execute(cmd, cons); Counters.ExternalHostProcesses++; process.Completed += ProcessExited; } catch (Exception ex) { if (tmpFile != null) { try { File.Delete(tmpFile); } catch { } } LoggingService.LogError(ex.ToString()); throw; } } }
protected DebuggerSession Start (string test) { DotNetExecutionCommand cmd = new DotNetExecutionCommand (); cmd.Command = Path.Combine (Path.GetDirectoryName (GetType ().Assembly.Location), "MonoDevelop.Debugger.Tests.TestApp.exe"); cmd.Arguments = test; DebuggerStartInfo si = engine.CreateDebuggerStartInfo (cmd); DebuggerSession session = engine.CreateSession (); DebuggerSessionOptions ops = new DebuggerSessionOptions (); ops.EvaluationOptions = EvaluationOptions.DefaultOptions; ops.EvaluationOptions.EvaluationTimeout = 100000; FilePath path = Util.TestsRootDir; path = path.ParentDirectory.Combine ("src","addins","MonoDevelop.Debugger","MonoDevelop.Debugger.Tests.TestApp","Main.cs").FullPath; TextFile file = TextFile.ReadFile (path); int i = file.Text.IndexOf ("void " + test); if (i == -1) throw new Exception ("Test not found: " + test); i = file.Text.IndexOf ("/*break*/", i); if (i == -1) throw new Exception ("Break marker not found: " + test); int line, col; file.GetLineColumnFromPosition (i, out line, out col); Breakpoint bp = session.Breakpoints.Add (path, line); bp.Enabled = true; ManualResetEvent done = new ManualResetEvent (false); session.OutputWriter = delegate (bool isStderr, string text) { Console.WriteLine ("PROC:" + text); }; session.TargetHitBreakpoint += delegate { done.Set (); }; session.Run (si, ops); if (!done.WaitOne (3000)) throw new Exception ("Timeout while waiting for initial breakpoint"); return session; }
public static IAsyncOperation ProfileProcess (IProfiler profiler, Process process) { if (IdeApp.ProjectOperations.CurrentRunOperation != null && !IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted) return IdeApp.ProjectOperations.CurrentRunOperation; SwitchWorkbenchContext (ProfileWorkbenchContext); string workingDir = ProfilingService.GetProcessDirectory (process.Id); IExecutionHandler handler = profiler.GetProcessExecutionHandlerFactory (process); DotNetExecutionCommand cmd = new DotNetExecutionCommand (); cmd.WorkingDirectory = workingDir; return handler.Execute (cmd, null /*context.ConsoleFactory.CreateConsole (true)*/); }
public IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console) { var cmd = (AspNetExecutionCommand) command; var xspName = GetXspName (cmd); var xspPath = GetXspPath (cmd, xspName); if (xspPath.IsNullOrEmpty || !File.Exists (xspPath)) throw new UserException (string.Format ("The \"{0}\" web server cannot be started. Please ensure that it is installed.", xspName), null); //if it's a script, use a native execution handler if (xspPath.Extension != ".exe") { //set mono debug mode if project's in debug mode var envVars = cmd.TargetRuntime.GetToolsExecutionEnvironment (cmd.TargetFramework).Variables; if (cmd.DebugMode) { envVars = new Dictionary<string, string> (envVars); envVars ["MONO_OPTIONS"] = "--debug"; } var ncmd = new NativeExecutionCommand ( xspPath, cmd.XspParameters.GetXspParameters () + " --nonstop", cmd.BaseDirectory, envVars); return Runtime.ProcessService.GetDefaultExecutionHandler (ncmd).Execute (ncmd, console); } // Set DEVPATH when running on Windows (notice that this has no effect unless // <developmentMode developerInstallation="true" /> is set in xsp2.exe.config var evars = cmd.TargetRuntime.GetToolsExecutionEnvironment (cmd.TargetFramework).Variables; if (cmd.TargetRuntime is MsNetTargetRuntime) evars["DEVPATH"] = Path.GetDirectoryName (xspPath); var netCmd = new DotNetExecutionCommand ( xspPath, cmd.XspParameters.GetXspParameters () + " --nonstop", cmd.BaseDirectory, evars); netCmd.DebugMode = cmd.DebugMode; return cmd.TargetRuntime.GetExecutionHandler ().Execute (netCmd, console); }
protected void Start (string test) { TargetRuntime runtime; switch (EngineId) { case "MonoDevelop.Debugger.Win32": runtime = Runtime.SystemAssemblyService.GetTargetRuntime ("MS.NET"); break; case "Mono.Debugger.Soft": runtime = Runtime.SystemAssemblyService.GetTargetRuntimes () .OfType<MonoTargetRuntime> () .OrderByDescending(o => o.Version) .FirstOrDefault (); break; default: runtime = Runtime.SystemAssemblyService.DefaultRuntime; break; } if (runtime == null) { Assert.Ignore ("Runtime not found for: {0}", EngineId); return; } Console.WriteLine ("Target Runtime: " + runtime.DisplayRuntimeName + " " + runtime.Version); // main/build/tests FilePath path = Path.GetDirectoryName (GetType ().Assembly.Location); var exe = Path.Combine (path, "MonoDevelop.Debugger.Tests.TestApp.exe"); var cmd = new DotNetExecutionCommand (); cmd.TargetRuntime = runtime; cmd.Command = exe; cmd.Arguments = test; if (Platform.IsWindows) { var monoRuntime = runtime as MonoTargetRuntime; if (monoRuntime != null) { var psi = new System.Diagnostics.ProcessStartInfo (Path.Combine (monoRuntime.Prefix, "bin", "pdb2mdb.bat"), cmd.Command); psi.UseShellExecute = false; psi.CreateNoWindow = true; System.Diagnostics.Process.Start (psi).WaitForExit (); } } var dsi = engine.CreateDebuggerStartInfo (cmd); var soft = dsi as SoftDebuggerStartInfo; if (soft != null) { var assemblyName = AssemblyName.GetAssemblyName (exe); soft.UserAssemblyNames = new List<AssemblyName> (); soft.UserAssemblyNames.Add (assemblyName); } Session = engine.CreateSession (); var ops = new DebuggerSessionOptions (); ops.EvaluationOptions = EvaluationOptions.DefaultOptions; ops.EvaluationOptions.AllowTargetInvoke = AllowTargetInvokes; ops.EvaluationOptions.EvaluationTimeout = 100000; path = path.ParentDirectory.ParentDirectory.Combine ("src", "addins", "MonoDevelop.Debugger", "MonoDevelop.Debugger.Tests.TestApp", test + ".cs").FullPath; SourceFile = TextFile.ReadFile (path); TestName = test; AddBreakpoint ("break"); var done = new ManualResetEvent (false); Session.OutputWriter = (isStderr, text) => Console.WriteLine ("PROC:" + text); Session.TargetHitBreakpoint += (sender, e) => { done.Set (); Frame = e.Backtrace.GetFrame (0); lastStoppedPosition = Frame.SourceLocation; targetStoppedEvent.Set (); }; Session.TargetExceptionThrown += (sender, e) => { Frame = e.Backtrace.GetFrame (0); for (int i = 0; i < e.Backtrace.FrameCount; i++) { if (!e.Backtrace.GetFrame (i).IsExternalCode) { Frame = e.Backtrace.GetFrame (i); break; } } lastStoppedPosition = Frame.SourceLocation; targetStoppedEvent.Set (); }; Session.TargetStopped += (sender, e) => { Frame = e.Backtrace.GetFrame (0); lastStoppedPosition = Frame.SourceLocation; targetStoppedEvent.Set (); }; var targetExited = new ManualResetEvent (false); Session.TargetExited += delegate { targetExited.Set (); }; Session.Run (dsi, ops); switch (WaitHandle.WaitAny (new WaitHandle[]{ done, targetExited }, 30000)) { case 0: //Breakpoint is hit good... run tests now break; case 1: throw new Exception ("Test application exited before hitting breakpoint"); default: throw new Exception ("Timeout while waiting for initial breakpoint"); } }
public void Start (IList<string> userAssemblyPaths = null) { lock (this) { if (starting) return; starting = true; exitRequestEvent.Reset (); RemotingService.RegisterRemotingChannel (); BinaryFormatter bf = new BinaryFormatter (); ObjRef oref = RemotingServices.Marshal (this); MemoryStream ms = new MemoryStream (); bf.Serialize (ms, oref); string sref = Convert.ToBase64String (ms.ToArray ()); string tmpFile = null; if (executionHandlerFactory == null) executionHandlerFactory = Runtime.SystemAssemblyService.CurrentRuntime.GetExecutionHandler (); try { string location = Path.GetDirectoryName (System.Reflection.Assembly.GetExecutingAssembly ().Location); location = Path.Combine (location, "mdhost.exe"); tmpFile = Path.GetTempFileName (); StreamWriter sw = new StreamWriter (tmpFile); sw.WriteLine (sref); sw.WriteLine (Process.GetCurrentProcess ().Id); sw.WriteLine (Runtime.SystemAssemblyService.CurrentRuntime.RuntimeId); // Explicitly load Mono.Addins since the target runtime may not have it installed sw.WriteLine (2); sw.WriteLine (typeof(AddinManager).Assembly.Location); sw.WriteLine (typeof(Mono.Addins.Setup.SetupService).Assembly.Location); sw.Close (); string arguments = string.Format ("{0} \"{1}\"", id, tmpFile); DotNetExecutionCommand cmd = new DotNetExecutionCommand (location, arguments, AppDomain.CurrentDomain.BaseDirectory); if (userAssemblyPaths != null) cmd.UserAssemblyPaths = userAssemblyPaths; cmd.DebugMode = isDebugMode; ProcessHostConsole cons = new ProcessHostConsole (); var p = process = executionHandlerFactory.Execute (cmd, cons); Counters.ExternalHostProcesses++; process.Task.ContinueWith ((t) => ProcessExited (p)); } catch (Exception ex) { if (tmpFile != null) { try { File.Delete (tmpFile); } catch { } } LoggingService.LogError (ex.ToString ()); throw; } } }
protected virtual ExecutionCommand CreateExecutionCommand (ConfigurationSelector configSel, ProjectConfiguration configuration) { DotNetExecutionCommand cmd = new DotNetExecutionCommand (FileName); cmd.Arguments = configuration.CommandLineParameters; cmd.WorkingDirectory = Path.GetDirectoryName (FileName); cmd.EnvironmentVariables = new Dictionary<string, string> (configuration.EnvironmentVariables); return cmd; }
public void Start () { lock (this) { if (starting) return; starting = true; exitRequestEvent.Reset (); RemotingService.RegisterRemotingChannel (); BinaryFormatter bf = new BinaryFormatter (); ObjRef oref = RemotingServices.Marshal (this); MemoryStream ms = new MemoryStream (); bf.Serialize (ms, oref); string sref = Convert.ToBase64String (ms.ToArray ()); string tmpFile = null; if (executionHandlerFactory == null) executionHandlerFactory = Runtime.SystemAssemblyService.CurrentRuntime.GetExecutionHandler (); try { string location = Path.GetDirectoryName (System.Reflection.Assembly.GetExecutingAssembly ().Location); location = Path.Combine (location, "mdhost.exe"); ProcessHostConsole cons = new ProcessHostConsole (); tmpFile = Path.GetTempFileName (); File.WriteAllText (tmpFile, sref + "\n" + Process.GetCurrentProcess ().Id + "\n"); string arguments = string.Format("{0} \"{1}\"", id, tmpFile); DotNetExecutionCommand cmd = new DotNetExecutionCommand(location, arguments, AppDomain.CurrentDomain.BaseDirectory); cmd.DebugMode = isDebugMode; process = executionHandlerFactory.Execute (cmd, cons); Counters.ExternalHostProcesses++; process.Completed += ProcessExited; } catch (Exception ex) { if (tmpFile != null) { try { File.Delete (tmpFile); } catch { } } LoggingService.LogError (ex.ToString ()); throw; } } }
protected void Start (string test) { TargetRuntime runtime; switch (EngineId) { case "MonoDevelop.Debugger.Win32": runtime = Runtime.SystemAssemblyService.GetTargetRuntime ("MS.NET"); break; case "Mono.Debugger.Soft": runtime = Runtime.SystemAssemblyService.GetTargetRuntimes () .OfType<MonoTargetRuntime> () .OrderByDescending ((o) => { //Attempt to find latest version of Mono registred in IDE and use that for unit tests if (string.IsNullOrWhiteSpace (o.Version) || o.Version == "Unknown") return new Version (0, 0, 0, 0); int indexOfBeforeDetails = o.Version.IndexOf (" (", StringComparison.Ordinal); if (indexOfBeforeDetails == -1) return new Version (0, 0, 0, 0); string hopefullyVersion = o.Version.Remove (indexOfBeforeDetails); Version version; if (Version.TryParse (hopefullyVersion, out version)) { return version; } else { return new Version (0, 0, 0, 0); } }).FirstOrDefault (); break; default: runtime = Runtime.SystemAssemblyService.DefaultRuntime; break; } if (runtime == null) { Assert.Ignore ("Runtime not found for: {0}", EngineId); return; } Console.WriteLine ("Target Runtime: " + runtime.DisplayRuntimeName + " " + runtime.Version); // main/build/tests FilePath path = Path.GetDirectoryName (GetType ().Assembly.Location); var exe = Path.Combine (path, "MonoDevelop.Debugger.Tests.TestApp.exe"); var cmd = new DotNetExecutionCommand (); cmd.TargetRuntime = runtime; cmd.Command = exe; cmd.Arguments = test; if (Platform.IsWindows) { var monoRuntime = runtime as MonoTargetRuntime; if (monoRuntime != null) { var psi = new System.Diagnostics.ProcessStartInfo (Path.Combine (monoRuntime.Prefix, "bin", "pdb2mdb.bat"), cmd.Command); psi.UseShellExecute = false; psi.CreateNoWindow = true; System.Diagnostics.Process.Start (psi).WaitForExit (); } } var dsi = engine.CreateDebuggerStartInfo (cmd); var soft = dsi as SoftDebuggerStartInfo; if (soft != null) { var assemblyName = AssemblyName.GetAssemblyName (exe); soft.UserAssemblyNames = new List<AssemblyName> (); soft.UserAssemblyNames.Add (assemblyName); } Session = engine.CreateSession (); var ops = new DebuggerSessionOptions (); ops.ProjectAssembliesOnly = true; ops.EvaluationOptions = EvaluationOptions.DefaultOptions; ops.EvaluationOptions.AllowTargetInvoke = AllowTargetInvokes; ops.EvaluationOptions.EvaluationTimeout = 100000; path = path.ParentDirectory.ParentDirectory.Combine ("src", "addins", "MonoDevelop.Debugger", "MonoDevelop.Debugger.Tests.TestApp", test + ".cs").FullPath; SourceFile = TextFile.ReadFile (path); TestName = test; AddBreakpoint ("break"); var done = new ManualResetEvent (false); Session.TargetHitBreakpoint += (sender, e) => { Frame = e.Backtrace.GetFrame (0); lastStoppedPosition = Frame.SourceLocation; targetStoppedEvent.Set (); done.Set (); }; Session.TargetExceptionThrown += (sender, e) => { Frame = e.Backtrace.GetFrame (0); for (int i = 0; i < e.Backtrace.FrameCount; i++) { if (!e.Backtrace.GetFrame (i).IsExternalCode) { Frame = e.Backtrace.GetFrame (i); break; } } lastStoppedPosition = Frame.SourceLocation; targetStoppedEvent.Set (); }; Session.TargetStopped += (sender, e) => { //This can be null in case of ForcedStop //which is called when exception is thrown //when Continue & Stepping is executed if (e.Backtrace != null) { Frame = e.Backtrace.GetFrame (0); lastStoppedPosition = Frame.SourceLocation; targetStoppedEvent.Set (); } else { Console.WriteLine ("e.Backtrace is null"); } }; var targetExited = new ManualResetEvent (false); Session.TargetExited += delegate { targetExited.Set (); }; Session.Run (dsi, ops); Session.ExceptionHandler = (ex) => { Console.WriteLine ("Session.ExceptionHandler:" + Environment.NewLine + ex.ToString ()); return true; }; switch (WaitHandle.WaitAny (new WaitHandle[]{ done, targetExited }, 30000)) { case 0: //Breakpoint is hit good... run tests now break; case 1: throw new Exception ("Test application exited before hitting breakpoint"); default: throw new Exception ("Timeout while waiting for initial breakpoint"); } if (Session is SoftDebuggerSession) { Console.WriteLine ("SDB protocol version:" + ((SoftDebuggerSession)Session).ProtocolVersion); } }
protected virtual ExecutionCommand CreateExecutionCommand (ConfigurationSelector configSel, DotNetProjectConfiguration configuration) { DotNetExecutionCommand cmd = new DotNetExecutionCommand (configuration.CompiledOutputName); cmd.Arguments = configuration.CommandLineParameters; cmd.WorkingDirectory = Path.GetDirectoryName (configuration.CompiledOutputName); cmd.EnvironmentVariables = configuration.GetParsedEnvironmentVariables (); cmd.TargetRuntime = TargetRuntime; cmd.UserAssemblyPaths = GetUserAssemblyPaths (configSel); return cmd; }
public ProcessAsyncOperation Execute (ExecutionCommand command, OperationConsole console) { var cmd = (AspNetExecutionCommand) command; var xspPath = GetXspPath (cmd); var evars = new Dictionary<string, string>(cmd.EnvironmentVariables); foreach (var v in cmd.TargetRuntime.GetToolsExecutionEnvironment (cmd.TargetFramework).Variables) { if (!evars.ContainsKey (v.Key)) evars.Add (v.Key, v.Value); } //HACK: work around Mono trying to create registry in non-writable location if (cmd.TargetRuntime is MonoTargetRuntime && !Platform.IsWindows) { evars ["MONO_REGISTRY_PATH"] = UserProfile.Current.TempDir.Combine ("aspnet-registry"); } //if it's a script, use a native execution handler if (xspPath.Extension != ".exe") { //set mono debug mode if project's in debug mode if (cmd.DebugMode) { evars ["MONO_OPTIONS"] = "--debug"; } var ncmd = new NativeExecutionCommand ( xspPath, cmd.XspParameters.GetXspParameters () + " --nonstop", cmd.BaseDirectory, evars); return Runtime.ProcessService.GetDefaultExecutionHandler (ncmd).Execute (ncmd, console); } // Set DEVPATH when running on Windows (notice that this has no effect unless // <developmentMode developerInstallation="true" /> is set in xsp2.exe.config if (cmd.TargetRuntime is MsNetTargetRuntime) evars["DEVPATH"] = Path.GetDirectoryName (xspPath); var netCmd = new DotNetExecutionCommand ( xspPath, cmd.XspParameters.GetXspParameters () + " --nonstop", cmd.BaseDirectory, evars); netCmd.DebugMode = cmd.DebugMode; return cmd.TargetRuntime.GetExecutionHandler ().Execute (netCmd, console); }
public void Start(IList <string> userAssemblyPaths = null) { lock (this) { if (starting) { return; } starting = true; exitRequestEvent.Reset(); RemotingService.RegisterRemotingChannel(); BinaryFormatter bf = new BinaryFormatter(); ObjRef oref = RemotingServices.Marshal(this); MemoryStream ms = new MemoryStream(); bf.Serialize(ms, oref); string sref = Convert.ToBase64String(ms.ToArray()); string tmpFile = null; if (executionHandlerFactory == null) { executionHandlerFactory = Runtime.SystemAssemblyService.CurrentRuntime.GetExecutionHandler(); } try { string location = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); location = Path.Combine(location, "mdhost.exe"); tmpFile = Path.GetTempFileName(); StreamWriter sw = new StreamWriter(tmpFile); sw.WriteLine(sref); sw.WriteLine(Process.GetCurrentProcess().Id); sw.WriteLine(Runtime.SystemAssemblyService.CurrentRuntime.RuntimeId); // Explicitly load Mono.Addins since the target runtime may not have it installed sw.WriteLine(2); sw.WriteLine(typeof(AddinManager).Assembly.Location); sw.WriteLine(typeof(Mono.Addins.Setup.SetupService).Assembly.Location); sw.Close(); string arguments = string.Format("{0} \"{1}\"", id, tmpFile); DotNetExecutionCommand cmd = new DotNetExecutionCommand(location, arguments, AppDomain.CurrentDomain.BaseDirectory); if (userAssemblyPaths != null) { cmd.UserAssemblyPaths = userAssemblyPaths; } cmd.DebugMode = isDebugMode; ProcessHostConsole cons = new ProcessHostConsole(); process = executionHandlerFactory.Execute(cmd, cons); Counters.ExternalHostProcesses++; process.Completed += ProcessExited; } catch (Exception ex) { if (tmpFile != null) { try { File.Delete(tmpFile); } catch { } } LoggingService.LogError(ex.ToString()); throw; } } }