Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set breakpoint in .cshtml file - VS2013

I need to see what values are passed to the model in my razor .cshtml view.

I try to set a breakpoint or write to Debug, but neither is working.

I am in a Debug mode, and also have

    <compilation debug="true" targetFramework="4.5" />

in web.config

How can I debug a View C# code?

enter image description here

like image 386
alex440 Avatar asked Mar 19 '23 14:03

alex440


1 Answers

You can insert this line in the server-side portion of the .cshtml file:

System.Diagnostics.Debugger.Break();

When running the website, you will (or at least you should) see a system-level dialog prompting you to launch Visual Studio to debug the application (in this case, the w3wp.exe process.)

like image 176
taiji123 Avatar answered Mar 24 '23 04:03

taiji123