gpt4 book ai didi

c# - 当调试器分离时,应用程序能否得到通知?

转载 作者:行者123 更新时间:2023-11-28 07:30:54 24 4
gpt4 key购买 nike

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

最佳答案

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();

关于c# - 当调试器分离时,应用程序能否得到通知?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17745468/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com