views:

49

answers:

1

Hello, 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);
    }
A: 

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.

queen3
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.
kingrichard2005