2

I'm having a problem debugging my unit tests in ASP.Net MVC. Whenever I try and debug a selected test, the breakpoint I set turns in a hollow circle with a warning sign. When I hover over it I get the following error:

"The breakpoint will not currently be hit. No symbols have been loaded for this document."

I've searched on the MSDN for this error and one of the causes seems to be that matching symbols were unable to be located, so breakpoints cannot be mapped from source to machine code. I'm not sure what to make of this.

  • What are these symbols?
  • How can I create them?
  • Are they supposed to be automatically generated?

As a side note, I can debug my regular project just fine. This error only seems to be affecting the unit tests for my project. Thanks for the help.

Update:

@jamesaharvey - Yes, so far I've tried debugging a couple of my tests with the same results, hollow debug circle with a warning sign.

Sample Test:

    /// <summary>
    ///A test for RequestForm with an existing user
    ///</summary>
    [TestMethod()]
    [HostType("ASP.NET")]
    [AspNetDevelopmentServerHost("C:\\projects\\webDirectoryCorrectionRequest\\trunk\\WebDirectoryCorrectionRequest\\WebDirectoryCorrectionRequest", "/")]
    [UrlToTest("http://localhost:54191/")]
    public void RequestFormTest_2()
    {
        //Create Controller
        var controller = new FormController();

        //Create fake controller context
        var formParams = new NameValueCollection { { "CN", "Swanson,Judith A" }, { "Type", "SNF" } };
        controller.ControllerContext = new FakeControllerContext(controller, formParams);

        //FormController target = new FormController();
        var actual = controller.RequestForm() as ViewResult;
        Assert.AreEqual("RequestForm", actual.ViewName);
    }
4
  • Is this for all of your tests? Can you add a code example? Commented Jan 25, 2010 at 18:11
  • How are you running your unit tests? Commented Jan 25, 2010 at 18:14
  • @Min - I'm using the Test View window to run each test individually or selecting a collection of tests to run. For the tests I want to debug, I right-click on the test and hit debug selection. Commented Jan 25, 2010 at 18:18
  • What are you using to unit test? Are you using the built in MS unit testing or nunit? Commented Jan 25, 2010 at 20:21

1 Answer 1

2

See if this helps: http://forums.asp.net/p/1246417/2291629.aspx

[ClassInitialize()]
public static void MyClassInitialize(TestContext testContext)
{
    System.Diagnostics.Debugger.Launch();
}

Actually just google for http://www.google.com/search?q=AspNetDevelopmentServerHost+attach, seems to be a pretty common issue.

Sign up to request clarification or add additional context in comments.

1 Comment

Worked like a charm, thanks queen3!! :-) It also helped to read through the forum link you posted, it really shed some light on the whole process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.