public void WaitForMode(dbgDebugMode mode) { for (int i = 0; i < 60 && Dte.Debugger.CurrentMode != mode; i++) { System.Threading.Thread.Sleep(500); } Assert.AreEqual(mode, Dte.Debugger.CurrentMode); }
private void OnModeChanged(dbgDebugMode mode) { if (mode != vsMode) { vsMode = mode; Changed?.Invoke(this); } }
internal static void WaitForMode(VisualStudioApp app, dbgDebugMode mode) { for (int i = 0; i < 30 && app.Dte.Debugger.CurrentMode != mode; i++) { Thread.Sleep(1000); } Assert.AreEqual(mode, app.Dte.Debugger.CurrentMode); }
private static void WaitForMode(dbgDebugMode mode) { for (int i = 0; i < 300 && VsIdeTestHostContext.Dte.Debugger.CurrentMode != mode; i++) { Thread.Sleep(100); } Assert.AreEqual(VsIdeTestHostContext.Dte.Debugger.CurrentMode, mode); }
/// <summary> /// Waits for debugger to get into a specified mode /// </summary> /// <param name="mode">Debugger mode to wait for</param> /// <param name="timeout">Timeout in seconds</param> public void WaitForMode(dbgDebugMode mode, int timeout) { for (int i = 0; i < timeout && Dte.Debugger.CurrentMode != mode; i++) { System.Threading.Thread.Sleep(1000); } Assert.AreEqual(mode, VSTestContext.DTE.Debugger.CurrentMode); }
void CreateBadgeForCurrentSolution( string solutionPath, string solutionName, string branchName, string activeDocumentName, dbgDebugMode debugMode) { try { var view = GetSolutionBadgeView(); RefreshIconicBitmap(view); } catch (Exception ex) { ex.TryAddContextData("solution path", () => solutionPath); ex.TryAddContextData("solution name", () => solutionName); ex.TryAddContextData("debug mode", () => debugMode); throw; } }
private static Process2 AttachAndWaitForMode(VisualStudioApp app, SD.Process processToAttach, object debugEngines, dbgDebugMode expectedMode) { Debugger2 dbg2 = (Debugger2)app.Dte.Debugger; System.Threading.Thread.Sleep(1000); Process2 result = null; Transport t = dbg2.Transports.Item("Default"); bool foundit = false; foreach (Process2 p in dbg2.LocalProcesses) { if (p.ProcessID == processToAttach.Id) { foundit = true; p.Attach2(debugEngines); result = p; break; } } Assert.IsTrue(foundit, "The process to attach [{0}] could not be found in LocalProcesses (did it exit immediately?)", processToAttach.Id); DebugProject.WaitForMode(app, expectedMode); return(result); }
public void WaitForMode(dbgDebugMode dbgDebugMode) { throw new NotImplementedException(); }
public void WaitForMode(dbgDebugMode dbgDebugMode) { App.WaitForMode(dbgDebugMode); }
private void OnModeChanged(dbgDebugMode mode) { VsMode = mode; IdeModeChanged?.Invoke(VsMode); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Start debugging /// </summary> /// <param name="o"></param> /// ------------------------------------------------------------------------------------ private void StartDebug(object o) { if (!m_Semaphore.WaitOne(100, true)) { return; // must already be dealing with a build } try { bool fCancel = false; try { dbgDebugMode debugMode = DTE.Debugger.CurrentMode; switch (debugMode) { case dbgDebugMode.dbgRunMode: // already running, so we shouldn't do anything return; case dbgDebugMode.dbgBreakMode: // we're stopped at a breakpoint, so just continue DTE.Debugger.Go(false); return; case dbgDebugMode.dbgDesignMode: fCancel = BuildForDebugging(); break; } } catch (TargetException) { // This gives an exception right now - don't know why. // Array activeProjects = (Array)DTE.ActiveSolutionProjects; // EnvDTE.Project vsProject = (EnvDTE.Project)activeProjects.GetValue(0); // // DTE.Solution.SolutionBuild.BuildProject( // DTE.Solution.SolutionBuild.ActiveConfiguration.Name, // Path.GetFileNameWithoutExtension(vsProject.Name), true); fCancel = false; } try { if (!fCancel) { Array activeProjects = (Array)DTE.ActiveSolutionProjects; Project vsProject = (EnvDTE.Project)activeProjects.GetValue(0); Configuration config = vsProject.ConfigurationManager.ActiveConfiguration; Property startAction = (Property)config.Properties.Item("StartAction"); Property startProgram = (Property)config.Properties.Item("StartProgram"); Property outputType = (Property)vsProject.Properties.Item("OutputType"); //Property assemblyName = (Property)vsProject.Properties.Item("AssemblyName"); //FileInfo outputFile = new FileInfo(Path.Combine((string)startProgram.Value, // (string)assemblyName.Value + ".dll")); FileInfo startFile = null; if (startProgram.Value != null && ((string)startProgram.Value).Length > 0) { startFile = new FileInfo((string)startProgram.Value); } if ((int)outputType.Value == 2 && (int)startAction.Value == 0) { // We can't directly start a Class Library project MessageBox.Show("Can't start a class library without executable specified. Please verify your Project properties", "Can't start debugger"); } else if ((int)outputType.Value == 2 && ((int)startAction.Value == 1 && (startFile == null || !startFile.Exists))) { // Can't find executable MessageBox.Show("Can't find executable specified for class library. Please verify your Project properties", "Can't start debugger"); } else { DTE.Debugger.Go(false); } //foreach (Property prop in config.Properties) //{ // System.Diagnostics.Debug.WriteLine(prop.Name + "=" + prop.Value); // if (prop.Name == "StartAction") // System.Diagnostics.Debug.WriteLine("\n"); //} //foreach (Property prop in vsProject.Properties) //{ // System.Diagnostics.Debug.WriteLine("Project:" + prop.Name); // if (prop.Name == "OutputType") // System.Diagnostics.Debug.WriteLine("\n"); //} } } catch { } } finally { m_Semaphore.Release(); } }
private static Process2 AttachAndWaitForMode(VisualStudioApp app, SD.Process processToAttach, object debugEngines, dbgDebugMode expectedMode) { Debugger2 dbg2 = (Debugger2)app.Dte.Debugger; System.Threading.Thread.Sleep(1000); Process2 result = null; Transport t = dbg2.Transports.Item("Default"); bool foundit = false; foreach (Process2 p in dbg2.LocalProcesses) { if (p.ProcessID == processToAttach.Id) { foundit = true; p.Attach2(debugEngines); result = p; break; } } Assert.IsTrue(foundit, "The process to attach [{0}] could not be found in LocalProcesses (did it exit immediately?)", processToAttach.Id); DebugProject.WaitForMode(app, expectedMode); return result; }