Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set a breakpoint in a cshtml file in Visual Studio 2010?

I'm debugging some code contained in a cshtml file, within an MVC application. If I put a deliberate error in the code, then Visual Studio (2010) gives me the option to break on that line, at which point I can watch local variables etc. The file at this point is tagged as [dynamic].

I would like to put a breakpoint in the file without having to break the code with a deliberate error, and I thought it was possible to get up a list of currently loaded (dynamic) files and put a breakpoint in one of them, but if I search on such things as "dynamic" and "cshtml" I get nowhere.

I suspect this should be easy, but I can't work out how to do it! Hoping you can help.

like image 940
Geekette Avatar asked Nov 04 '22 08:11

Geekette


1 Answers

Aha! The Solution Explorer has a list of currently-loaded scripts in the Solution Explorer, under "Script Documents". I tried looking there but couldn't find my code because it is contained in a file named Index.cshtml, but is within an MVC view named something else, and that's the name listed in the solution explorer.

like image 111
Geekette Avatar answered Nov 12 '22 13:11

Geekette