3

我正在尝试使用 VS-macro 使用 nunit-console 从 Visual Studio 调试测试,但是在将调试器/IDE 附加到 nunit-console/nunit-agent 时遇到问题。我确实有宏工作,如果我只是想运行测试,问题只是在附加调试器时。

我似乎有某种僵局问题。当我启动宏时,它会冻结 IDE。附加后,测试在断点处暂停(我认为),但我看不到这一点,因为 IDE 已冻结。我无法单步执行等,因为宏正在锁定 IDE,并且我无法继续测试,因为它在断点处停止。有任何想法吗?

我不能使用 resharper / testdriven / extensions 等,没有第 3 方,不要问 :(,所以它是宏,类似的东西,或者什么都没有。

使用 Nunit 2.5.7、VS 2010、.net 4 项目。

到目前为止我所拥有的

process.Start() 'run nunit-console

If attachDebugger then
 For Each debugProcess As EnvDTE.Process In DTE.Debugger.LocalProcesses

   ' no parent process ID on process type, so have to look at name for the agent.
   If debugProcess.ProcessID = process.Id Or debugProcess.Name.Contains("nunit-agent") Then
     debugProcess.Attach()
   End If

 Next
End If    

process.WaitForExit()

DTE.Debugger.DetachAll()
4

1 回答 1

1

这只是一个猜测,但我怀疑 Visual Studio 正在其孤独的 UI 线程上运行宏。

也许你可以试试这个:

在您的宏中,启动另一个线程并运行您在其中编写的代码。让宏立即退出。

于 2012-03-22T14:56:05.393 回答