/// <summary> /// Sets the instance of currently running Visual Studio IDE. /// </summary> /// <param name="dte">The DTE.</param> internal static void SetDTE(DTE dte) { DTE = dte; if (dte != null) { debuggerEvents = DTE.Events.DebuggerEvents; debuggerEvents.OnEnterBreakMode += DebuggerEvents_OnEnterBreakMode; debuggerEvents.OnEnterDesignMode += DebuggerEvents_OnEnterDesignMode; debuggerEvents.OnEnterRunMode += DebuggerEvents_OnEnterRunMode; debuggerProxy = (VSDebuggerProxy)AppDomain.CurrentDomain.GetData(VSDebuggerProxy.AppDomainDataName) ?? new VSDebuggerProxy(); VSDebugger = new VSDebugger(debuggerProxy); Engine.Context.InitializeDebugger(VSDebugger, new DiaSymbolProvider()); Engine.Context.ClrProvider = VSDebugger; } else { // 90s all over again :) var timer = new System.Windows.Threading.DispatcherTimer(); timer.Tick += (a, b) => { timer.Stop(); if (DTE == null) { InitializeDTE(); } }; timer.Interval = TimeSpan.FromSeconds(0.1); timer.Start(); } }
/// <summary> /// Occurs when debugger enters break mode. /// </summary> /// <param name="reason">The reason.</param> /// <param name="executionAction">The execution action.</param> private static void DebuggerEvents_OnEnterBreakMode(dbgEventReason reason, ref dbgExecutionAction executionAction) { DebuggerEnteredBreakMode?.Invoke(); VSDebugger?.UpdateCache(); }
/// <summary> /// Occurs when debugger enters design mode. /// </summary> /// <param name="reason">The reason.</param> private static void DebuggerEvents_OnEnterDesignMode(dbgEventReason reason) { DebuggerEnteredDesignMode?.Invoke(); VSDebugger?.UpdateCache(); }