private string SerializeDebuggerOptions(string jsonDebugOptions) { try { NLogService.TraceEnteringMethod(Logger); var debugOptions = DebugOptions.DeserializeFromJson(jsonDebugOptions); _session = new SoftDebuggerSession(); LogMonoDebuggerAssemblyPaths(); if (debugOptions.UserSettings.EnableVerboseDebugLogging) { RegisterEventHandlers(); } var connectionTimeout = 30000; var evaluationTimeout = 30000; var startupProject = StartupProject; var softDebuggerConnectArgs = new SoftDebuggerConnectArgs(debugOptions.TargetExeFileName, debugOptions.GetHostIP(), debugOptions.GetMonoDebugPort()); // TODO implement programm output via stream //softDebuggerConnectArgs.RedirectOutput = true; //softDebuggerConnectArgs.OutputPort = ???; //_session.VirtualMachine.StandardOutput ??? softDebuggerConnectArgs.TimeBetweenConnectionAttempts = (int)debugOptions.UserSettings.TimeBetweenConnectionAttemptsInMs; softDebuggerConnectArgs.MaxConnectionAttempts = (int)debugOptions.UserSettings.MaxConnectionAttempts; _startInfo = new StartInfo( softDebuggerConnectArgs, new DebuggingOptions() { EvaluationTimeout = evaluationTimeout, MemberEvaluationTimeout = evaluationTimeout, ModificationTimeout = evaluationTimeout, SocketTimeout = connectionTimeout }, startupProject ); SessionMarshalling sessionMarshalling = new SessionMarshalling(_session, _startInfo); using (MemoryStream ms = new MemoryStream()) { BinaryFormatter bf = new BinaryFormatter(); ObjRef oref = RemotingServices.Marshal(sessionMarshalling); bf.Serialize(ms, oref); return(Convert.ToBase64String(ms.ToArray())); } } catch (Exception ex) { Logger.Error(ex); throw; } }
public int LaunchSuspended(string pszServer, IDebugPort2 port, string exe, string args, string dir, string env, string options, enum_LAUNCH_FLAGS launchFlags, uint hStdInput, uint hStdOutput, uint hStdError, IDebugEventCallback2 ad7Callback, out IDebugProcess2 process) { DebugHelper.TraceEnteringMethod(); Callback = new EngineCallback(this, ad7Callback); var debugOptions = DebugOptions.DeserializeFromJson(options); HostName = debugOptions.GetHostIP().ToString(); ProgramName = exe; DebuggedProcess = new DebuggedProcess(this, debugOptions, Callback); DebuggedProcess.ApplicationClosed += OnApplicationClosed; DebuggedProcess.StartDebugging(); process = RemoteProcess = new MonoProcess(port); return(VSConstants.S_OK); }
private string SerializeDebuggerOptions(string jsonDebugOptions) { DebugHelper.TraceEnteringMethod(); var debugOptions = DebugOptions.DeserializeFromJson(jsonDebugOptions); _session = new SoftDebuggerSession(); _session.TargetReady += (sender, eventArgs) => { Debug.WriteLine("TargetReady!"); }; _session.ExceptionHandler = exception => true; _session.TargetExited += (sender, x) => { Debug.WriteLine("TargetExited!"); }; _session.TargetUnhandledException += (sender, x) => { Debug.WriteLine("TargetUnhandledException!"); }; _session.LogWriter = (stderr, text) => Debug.WriteLine(text); _session.OutputWriter = (stderr, text) => Debug.WriteLine(text); _session.TargetThreadStarted += (sender, x) => Debug.WriteLine("TargetThreadStarted!"); _session.TargetThreadStopped += (sender, x) => { Debug.WriteLine("TargetThreadStopped!"); }; _session.TargetStopped += (sender, x) => Debug.WriteLine(x.Type); _session.TargetStarted += (sender, x) => Debug.WriteLine("TargetStarted"); _session.TargetSignaled += (sender, x) => Debug.WriteLine(x.Type); _session.TargetInterrupted += (sender, x) => Debug.WriteLine(x.Type); _session.TargetExceptionThrown += (sender, x) => { Debug.WriteLine("TargetExceptionThrown!"); }; _session.TargetHitBreakpoint += (sender, x) => { Debug.WriteLine("TargetHitBreakpoint!"); }; _session.TargetEvent += _session_TargetEvent; var startupProject = StartupProject; _startInfo = new StartInfo( new SoftDebuggerConnectArgs(debugOptions.TargetExeFileName, debugOptions.GetHostIP(), debugOptions.GetMonoDebugPort()), new DebuggingOptions() { EvaluationTimeout = 30000, MemberEvaluationTimeout = 30000, ModificationTimeout = 30000, SocketTimeout = 30000 }, startupProject ); SessionMarshalling sessionMarshalling = new SessionMarshalling(_session, _startInfo); using (MemoryStream ms = new MemoryStream()) { BinaryFormatter bf = new BinaryFormatter(); ObjRef oref = RemotingServices.Marshal(sessionMarshalling); bf.Serialize(ms, oref); return(Convert.ToBase64String(ms.ToArray())); } }
private string SerializeDebuggerOptions(string jsonDebugOptions) { try { NLogService.TraceEnteringMethod(); var debugOptions = DebugOptions.DeserializeFromJson(jsonDebugOptions); _session = new SoftDebuggerSession(); _session.TargetReady += (sender, eventArgs) => { Debug.WriteLine("TargetReady!"); }; _session.ExceptionHandler = exception => true; _session.TargetExited += (sender, x) => { Debug.WriteLine("TargetExited!"); }; _session.TargetUnhandledException += (sender, x) => { Debug.WriteLine("TargetUnhandledException!"); }; _session.LogWriter = (stderr, text) => Debug.WriteLine(text); _session.OutputWriter = (stderr, text) => Debug.WriteLine(text); _session.TargetThreadStarted += (sender, x) => Debug.WriteLine("TargetThreadStarted!"); _session.TargetThreadStopped += (sender, x) => { Debug.WriteLine("TargetThreadStopped!"); }; _session.TargetStopped += (sender, x) => Debug.WriteLine(x.Type); _session.TargetStarted += (sender, x) => Debug.WriteLine("TargetStarted"); _session.TargetSignaled += (sender, x) => Debug.WriteLine(x.Type); _session.TargetInterrupted += (sender, x) => Debug.WriteLine(x.Type); _session.TargetExceptionThrown += (sender, x) => { Debug.WriteLine("TargetExceptionThrown!"); }; _session.TargetHitBreakpoint += (sender, x) => { Debug.WriteLine("TargetHitBreakpoint!"); }; _session.TargetEvent += _session_TargetEvent; var connectionTimeout = 30000; var evaluationTimeout = 30000; var startupProject = StartupProject; var softDebuggerConnectArgs = new SoftDebuggerConnectArgs(debugOptions.TargetExeFileName, debugOptions.GetHostIP(), debugOptions.GetMonoDebugPort()); // TODO implement programm output via stream //softDebuggerConnectArgs.RedirectOutput = true; //softDebuggerConnectArgs.OutputPort = ???; //_session.VirtualMachine.StandardOutput ??? softDebuggerConnectArgs.TimeBetweenConnectionAttempts = (int)debugOptions.UserSettings.TimeBetweenConnectionAttemptsInMs; softDebuggerConnectArgs.MaxConnectionAttempts = (int)debugOptions.UserSettings.MaxConnectionAttempts; _startInfo = new StartInfo( softDebuggerConnectArgs, new DebuggingOptions() { EvaluationTimeout = evaluationTimeout, MemberEvaluationTimeout = evaluationTimeout, ModificationTimeout = evaluationTimeout, SocketTimeout = connectionTimeout }, startupProject ); SessionMarshalling sessionMarshalling = new SessionMarshalling(_session, _startInfo); using (MemoryStream ms = new MemoryStream()) { BinaryFormatter bf = new BinaryFormatter(); ObjRef oref = RemotingServices.Marshal(sessionMarshalling); bf.Serialize(ms, oref); return(Convert.ToBase64String(ms.ToArray())); } } catch (Exception ex) { NLogService.Logger.Error(ex); throw; } }
private string SerializeDebuggerOptions(string jsonDebugOptions) { try { NLogService.TraceEnteringMethod(); var debugOptions = DebugOptions.DeserializeFromJson(jsonDebugOptions, null); _session = new SoftDebuggerSession(); _session.TargetReady += (sender, eventArgs) => { Debug.WriteLine("TargetReady!"); }; _session.ExceptionHandler = exception => true; _session.TargetExited += (sender, x) => { Debug.WriteLine("TargetExited!"); }; _session.TargetUnhandledException += (sender, x) => { Debug.WriteLine("TargetUnhandledException!"); }; _session.LogWriter = (stderr, text) => Debug.WriteLine(text); _session.OutputWriter = (stderr, text) => Debug.WriteLine(text); _session.TargetThreadStarted += (sender, x) => Debug.WriteLine("TargetThreadStarted!"); _session.TargetThreadStopped += (sender, x) => { Debug.WriteLine("TargetThreadStopped!"); }; _session.TargetStopped += (sender, x) => Debug.WriteLine(x.Type); _session.TargetStarted += (sender, x) => Debug.WriteLine("TargetStarted"); _session.TargetSignaled += (sender, x) => Debug.WriteLine(x.Type); _session.TargetInterrupted += (sender, x) => Debug.WriteLine(x.Type); _session.TargetExceptionThrown += (sender, x) => { Debug.WriteLine("TargetExceptionThrown!"); }; _session.TargetHitBreakpoint += (sender, x) => { Debug.WriteLine("TargetHitBreakpoint!"); }; _session.TargetEvent += _session_TargetEvent; var connectionTimeout = 30000; var evaluationTimeout = 30000; var startupProject = StartupProject; SoftDebuggerRemoteArgs softDebuggerArgs; if (debugOptions.RunAsDebugServer) { softDebuggerArgs = new SoftDebuggerListenArgs(debugOptions.AppName, debugOptions.HostIPAddress, debugOptions.DebugPort) { TimeBetweenConnectionAttempts = debugOptions.TimeBetweenConnectionAttemptsMs, MaxConnectionAttempts = debugOptions.MaxConnectionAttempts }; } else { softDebuggerArgs = new SoftDebuggerConnectArgs(debugOptions.AppName, debugOptions.HostIPAddress, debugOptions.DebugPort) { TimeBetweenConnectionAttempts = debugOptions.TimeBetweenConnectionAttemptsMs, MaxConnectionAttempts = debugOptions.MaxConnectionAttempts }; } _startInfo = new StartInfo( softDebuggerArgs, new DebuggingOptions() { EvaluationTimeout = evaluationTimeout, MemberEvaluationTimeout = evaluationTimeout, ModificationTimeout = evaluationTimeout, SocketTimeout = connectionTimeout }, startupProject ); SessionMarshalling sessionMarshalling = new SessionMarshalling(_session, _startInfo); using (MemoryStream ms = new MemoryStream()) { BinaryFormatter bf = new BinaryFormatter(); ObjRef oref = RemotingServices.Marshal(sessionMarshalling); bf.Serialize(ms, oref); return(Convert.ToBase64String(ms.ToArray())); } } catch (Exception ex) { NLogService.Logger.Error(ex); throw; } }