When setting a break point in a razor view (".cshtml") the circle which is normally red turns to a red hollow circle when the debugger is started. When hovering over the hollow circle it displays the following:
The breakpoint will not currently be hit. No symbols have been loaded for this document
It's only razor view files, with normal ".cs" files there are no problems.
There are a lot of other questions which have proposed solutions for the same "error" message as above but none has actually worked. What I have tried:
Edit: I'm referring to the razor code of course, not html or even javascript. E.g. setting a break point in a foreach loop in razor
Edit2: I'm able to step through the razor code if I set a breakpoint in a controller, as the the debugger will go through the view before being "done". I'm still not able to actually set breakpoints in razor view files though. The hollow circle is still showing and it won't get hit.
Edit3: Killing the "IIS Working Process" which points to w3wp.exe temporary solved the problem. I was able to debug razor views again. A few hours later, the same problem again.
I found out that toggling the Build Action = Content / Compile (in the property window) on the .cshtml
file (with a build in between) let me set break points again.
This is what your looking for.
You need to compile your views at compile time not asp.net runtime.
https://stackoverflow.com/a/16052993/955831
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With