0

当使用 F4 又名Stop Debugging分离 VS 调试器时,VS调试器是否会引发一些可以在 C++ 或 C# 应用程序中捕获的信号或异常?关于它何时附加的相同问题,尽管这对我来说用处不大 - 尽管我想这可以通过IsDebuggerPresent在 C++ 中使用单独的线程来解决。

4

1 回答 1

1

没有从 Visual Studio 发送的事件。但你可以像这样模拟:

      var t = new Thread(new ThreadStart(() =>
      {
        while (true)
        {
          if (!Debugger.IsAttached)
          {
            //Check if the IsAttached Changed raise a custom event DebuggerDetached
          }
          else
          {
            //Check if the IsAttached Changed raise a custom event DebuggerAttached
          }

          Thread.Sleep(100);
        }
      }));

      t.Start();
于 2013-07-19T12:11:17.787 回答