public bool StartDebugger(SoftDebuggerSession session, StartInfo startInfo) { tracer.Verbose("Entering Launch for: {0}", this); var debugger = ServiceProvider.GlobalProvider.GetService <SVsShellDebugger, IVsDebugger4>(); var sessionMarshalling = new SessionMarshalling(session, startInfo); VsDebugTargetInfo4 info = new VsDebugTargetInfo4(); info.dlo = (uint)Microsoft.VisualStudio.Shell.Interop.DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; var startArgs = startInfo.StartArgs; var appName = "Mono"; if (startArgs is SoftDebuggerRemoteArgs) { appName = ((SoftDebuggerRemoteArgs)startArgs).AppName; } else if (startArgs is SoftDebuggerLaunchArgs) { appName = Path.GetFileNameWithoutExtension(startInfo.Command); } info.bstrExe = appName; info.bstrCurDir = ""; info.bstrArg = null; // no command line parameters info.bstrRemoteMachine = null; info.fSendToOutputWindow = 0; // Let stdout stay with the application. info.guidPortSupplier = Guids.PortSupplierGuid; info.guidLaunchDebugEngine = Guids.EngineGuid; info.bstrPortName = appName; using (MemoryStream ms = new MemoryStream()) { BinaryFormatter bf = new BinaryFormatter(); ObjRef oref = RemotingServices.Marshal(sessionMarshalling); bf.Serialize(ms, oref); info.bstrOptions = Convert.ToBase64String(ms.ToArray()); } try { var results = new VsDebugTargetProcessInfo[1]; debugger.LaunchDebugTargets4(1, new[] { info }, results); return(true); } catch (Exception ex) { tracer.Error("Controller.Launch ()", ex); throw; } }
public bool StartDebugger(SoftDebuggerSession session, StartInfo startInfo) { IVsDebugger4 service = ServiceProvider.GlobalProvider.GetService(typeof(SVsShellDebugger)) as IVsDebugger4; if (service == null) { return(false); } SessionMarshalling sessionMarshalling = new SessionMarshalling(session, startInfo); VsDebugTargetInfo4 debugTargetInfo4 = new VsDebugTargetInfo4 { dlo = 1U, bstrExe = string.Format("CRYENGINE - {0}", startInfo.StartupProject.Name), bstrCurDir = "", bstrArg = null, bstrRemoteMachine = null, fSendToOutputWindow = 0, guidPortSupplier = Guids.PortSupplierGuid, guidLaunchDebugEngine = Guids.EngineGuid, bstrPortName = "Mono" }; using (MemoryStream memoryStream = new MemoryStream()) { BinaryFormatter binaryFormatter = new BinaryFormatter(); ObjRef objRef = RemotingServices.Marshal(sessionMarshalling); binaryFormatter.Serialize(memoryStream, objRef); debugTargetInfo4.bstrOptions = Convert.ToBase64String(memoryStream.ToArray()); } try { VsDebugTargetProcessInfo[] pLaunchResults = new VsDebugTargetProcessInfo[1]; service.LaunchDebugTargets4(1U, new VsDebugTargetInfo4[1] { debugTargetInfo4 }, pLaunchResults); return(true); } catch { throw; } }