How can I set a breakpoint in VS that will be hit when NUnit runs a test?

Asked by Chris Shaw

Setup: VS 2010; .NET 4.0; NUnit 2.5.7; 64-bit machine running Win7

I have a project which has recently been migrated from VS 2008 (.NET 3.5) to VS 2010 (.NET 4.0).

I run NUnit from VS (in both versions) by opening the project Properties page, setting the "Start Action" on the Debug tab to "Run external program" (nunit-x86.exe), the Command line argument to be the project's .dll, and the Working Directory to the \bin\Testing folder of the project.

Using NUnit 2.5.7 with the old version, I can put a breakpoint at the beginning of a test that I have written (or anywhere within the application code), and step through the code while NUnit is running the test.

Using 2.5.7 with the new version, the same test runs correctly, but the breakpoint is never hit, and VS 2010's IntelliSense informs me that "no symbols have been loaded for this document". Even setting VS to break on thrown exceptions doesn't work.

What am I missing?

Question information

Language:
English Edit question
Status:
Solved
For:
NUnit V2 Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Charlie Poole (charlie.poole) said :
#1

NUnit is starting on your machine under .NET 2.0 and launching a
separate process under
.NET 4.0 to execute the tests. You can attach to that process
(nunit-agent.exe) in order
to hit the breakpoint. You will need to reattach any time you reload
the tests - this is
a bug that we're addressing.

So long as a separate process is used, there is no avoiding at least
the first attach.
If you work exclusively in .NET 4.0, consider modifying the
nunit.exe.config or the
nunit-console.exe.config to force nunit to run under .NET 4.0.

Charlie

On Tue, Aug 3, 2010 at 8:43 AM, Chris Shaw
<email address hidden> wrote:
> New question #119862 on NUnit V2:
> https://answers.launchpad.net/nunitv2/+question/119862
>
> Setup:  VS 2010; .NET 4.0; NUnit 2.5.7; 64-bit machine running Win7
>
> I have a project which has recently been migrated from VS 2008 (.NET 3.5) to VS 2010 (.NET 4.0).
>
> I run NUnit from VS (in both versions) by opening the project Properties page, setting the "Start Action" on the Debug tab to "Run external program" (nunit-x86.exe), the Command line argument to be the project's .dll, and the Working Directory to the \bin\Testing folder of the project.
>
> Using NUnit 2.5.7 with the old version, I can put a breakpoint at the beginning of a test that I have written (or anywhere within the application code), and step through the code while NUnit is running the test.
>
> Using 2.5.7 with the new version, the same test runs correctly, but the breakpoint is never hit, and VS 2010's IntelliSense informs me that "no symbols have been loaded for this document".  Even setting VS to break on thrown exceptions doesn't work.
>
> What am I missing?
>
> --
> You received this question notification because you are an answer
> contact for NUnit V2.
>

Revision history for this message
Chris Shaw (cshaw-alionscience) said :
#2

Exactly what I was looking for -- Thanks!

--Chris

-----Original Message-----
From: <email address hidden> [mailto:<email address hidden>] On Behalf Of Charlie Poole
Sent: Tuesday, August 03, 2010 12:06 PM
To: Shaw, Christopher
Subject: Re: [Question #119862]: How can I set a breakpoint in VS that will behit when NUnit runs a test?

Your question #119862 on NUnit V2 changed:
https://answers.launchpad.net/nunitv2/+question/119862

    Status: Open => Answered

Charlie Poole proposed the following answer:
NUnit is starting on your machine under .NET 2.0 and launching a
separate process under
.NET 4.0 to execute the tests. You can attach to that process
(nunit-agent.exe) in order
to hit the breakpoint. You will need to reattach any time you reload
the tests - this is
a bug that we're addressing.

So long as a separate process is used, there is no avoiding at least
the first attach.
If you work exclusively in .NET 4.0, consider modifying the
nunit.exe.config or the
nunit-console.exe.config to force nunit to run under .NET 4.0.

Charlie

On Tue, Aug 3, 2010 at 8:43 AM, Chris Shaw
<email address hidden> wrote:
> New question #119862 on NUnit V2:
> https://answers.launchpad.net/nunitv2/+question/119862
>
> Setup:  VS 2010; .NET 4.0; NUnit 2.5.7; 64-bit machine running Win7
>
> I have a project which has recently been migrated from VS 2008 (.NET 3.5) to VS 2010 (.NET 4.0).
>
> I run NUnit from VS (in both versions) by opening the project Properties page, setting the "Start Action" on the Debug tab to "Run external program" (nunit-x86.exe), the Command line argument to be the project's .dll, and the Working Directory to the \bin\Testing folder of the project.
>
> Using NUnit 2.5.7 with the old version, I can put a breakpoint at the beginning of a test that I have written (or anywhere within the application code), and step through the code while NUnit is running the test.
>
> Using 2.5.7 with the new version, the same test runs correctly, but the breakpoint is never hit, and VS 2010's IntelliSense informs me that "no symbols have been loaded for this document".  Even setting VS to break on thrown exceptions doesn't work.
>
> What am I missing?
>
> --
> You received this question notification because you are an answer
> contact for NUnit V2.
>

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/nunitv2/+question/119862/+confirm?answer_id=0

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/nunitv2/+question/119862

You received this question notification because you are a direct
subscriber of the question.

Revision history for this message
Charlie Poole (charlie.poole) said :
#3

Your thank-you message reopened the question. Marking it answered again.

Revision history for this message
Charlie Poole (charlie.poole) said :
#4

I guess that should be 'Solved'