Brian Mains Brian Mains - 1 year ago 115
ASP.NET (C#) Question

Web API in MVC Project isn't hitting breakpoints ("symbols not loaded")

I have an ASP.NET MVC project, with an ASP.NET web api defined as an area in this project. So the structure is the following:

API (web API)

The app works as expected. However, I am having an issue with debugging. I can put a debugger in the MVC controller, and it works as expected. I cannot put a breakpoint in the web API controller, as I get "the breakpoint will not currently be hit. No symbols have been loaded for this document." I've been in the throes of it for some time, so it's probably a simple fix but I cannot figure it out. Any ideas why I'm getting this problem with web API controllers, when I can debug an MVC controller?

Answer Source

Until you find a permanent solution you can use the method System.Diagnostics.Debugger.Break() to force a break to occur on that line - just like a breakpoint:

public ActionResult IndexCheckInOut(string providerKey, DateTime? date = null)
    return View("Index");

Here are some links to articles that might help you find a more permanent solution:

The breakpoint will not currently be hit

Stepping into ASP.NET MVC source code with Visual Studio debugger

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download