We are using MDBG to attach to IIS worker processes.
After performing stack snapshots, we detach with MDBgProcess.Detach().
While this call normally takes 10-80ms, occassionally it hangs for a very long time, also freezing the process in the meantime.
This is unacceptable since the process is a production program.
Here is our complete code:
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();
}
}
}
Any ideas why this may happen, and what we can do about it?
Best, Mike
I don't know why it would hang up, but I think you potentially have a race condition - in my program, I block until the process is stopped using the WaitOne() on the Stop()...