C# 无法使用mdbg从进程分离
接下来,我现在有了可以使用MDBGAPI附加到进程的代码 问题是,如果需要,我无法从流程中分离。当我打电话时 mgProcess.Detach().WaitOne()(其中mgProcess是从MDbgEngine对象创建的MDbgProcess)我收到以下错误消息:C# 无法使用mdbg从进程分离,c#,.net,debugging,mdbg,C#,.net,Debugging,Mdbg,接下来,我现在有了可以使用MDBGAPI附加到进程的代码 问题是,如果需要,我无法从流程中分离。当我打电话时 mgProcess.Detach().WaitOne()(其中mgProcess是从MDbgEngine对象创建的MDbgProcess)我收到以下错误消息: Process not synchronized. (Exception from HRESULT: 0x80131302) at Microsoft.Samples.Debugging.CorDebug.Native
Process not synchronized. (Exception from HRESULT: 0x80131302)
at Microsoft.Samples.Debugging.CorDebug.NativeApi.ICorDebugController.Detach()
at Microsoft.Samples.Debugging.CorDebug.CorController.Detach() in C:\mdbg\src\debugger\corapi\Controller.cs:line 89
at Microsoft.Samples.Debugging.MdbgEngine.MDbgProcess.Detach() in C:\mdbg\src\debugger\mdbgeng\Process.cs:line 716
如果我只是尝试调用mgProcess.Detach()或mgProcess.CorProcess.Detach()我会得到相同的结果
有人知道分离Mdbg进程的正确方法吗?据了解,Mdbg不允许您执行任何操作 似乎是前进的方向。尝试以下方法:
proc.AsyncStop();
proc.Detach();
或
proc.AsyncStop();
proc.Detach();
Proc.CorProcess.Stop(0);
Proc.Detach();