Debug Visual Studio 2010 tests using nunit-console and VS-macro
I'm trying to debug tests from visual studio using nunit-console using a VS-macro, but I'm having issues when attaching the debugger / IDE to nunit-console / nunit-agent. I do have the macro working, if I just want to run the test, the issue is only when attaching the debugger.
I seem to have a deadlock issue of sorts. When I kickoff my macro, it freezes the IDE. After the attach, the test pauses at a break point (i think),but I cant see this, since the IDE is frozen. I cant stepthrough et开发者_如何学编程c, since the macro is locking up the IDE, and I cant continue the test, since its halted at a breakpoint. Any ideas?
I cant use resharper / testdriven / extensions etc, no 3rd party, dont ask :(, so its the macro, something like it, or nothing.
Using Nunit 2.5.7, VS 2010, .net 4 projects.
What I have so far
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()
It's just a guess, but I suspect that Visual Studio is running the macro on it's lonesome UI thread.
Perhaps you could try this:
In your Macro, spin up another thread and run the code you've written in that. Let the Macro exit immediately.
精彩评论