【问题标题】:Mdbg: unable to detach from processMdbg:无法从进程中分离
【发布时间】:2012-04-17 15:45:09
【问题描述】:

我们正在使用 MDBG 附加到 IIS 工作进程。

执行堆栈快照后,我们使用 MDBgProcess.Detach() 进行分离。

虽然此调用通常需要 10-80 毫秒,但有时它会挂起很长时间,同时也会冻结进程。

这是不可接受的,因为该过程是一个生产程序。

这是我们的完整代码:

try
{
    proc.AsyncStop();
}
finally
{
    // Make sure we are able to detach
    try
    {
        // delete all breakpoints
        proc.Breakpoints.DeleteAll();
    }
    catch (Exception e){}
    finally
    {
        // detach and wait
        var waitHandle = proc.Detach();
        if (proc.CanExecute())
        {
            waitHandle.WaitOne();
        }
    }
}

任何想法为什么会发生这种情况,以及我们能做些什么?

最好, 迈克

【问题讨论】:

    标签: debugging clr mdbg


    【解决方案1】:

    我不知道它为什么会挂起,但我认为您可能存在竞争条件 - 在我的程序中,我会阻塞,直到使用 Stop() 上的 WaitOne() 停止进程...

    proc.AsyncStop().WaitOne();
    m_Debugger.Processes.Active.Breakpoints.DeleteAll();
    proc.CorProcess.Detach(); // I don't wait here because this is where my prog ends
    

    【讨论】:

      猜你喜欢
      • 2015-11-19
      • 2018-03-19
      • 1970-01-01
      • 2016-05-17
      • 2021-12-15
      • 1970-01-01
      • 2015-08-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多