Visual Studio 2012 - breakpoints in Razor view files (".cshtml") do not load

When setting the break point in razor mode (".cshtml"), the circle that usually turns red turns into a red hollow circle when you start the debugger. When falling in an empty circle, displays the following:

At the moment, the breakpoint will not be deleted. No characters were loaded for this document

These are only razor viewing files, with normal .cs files there are no problems.

There are many other issues that suggested solutions for the same error message as above, but none of them worked. What I tried:

  • Cleaning solution
  • Ensuring that in properties -> web window in the "debugger" section that is checked by ASP.NET
  • Make sure that in the properties window β†’ Build it is indicated that both Define DEBUG and TRACE are checked, and in the output section in the same window, by clicking the "Advanced" button, the debugging information is set to "Full"
  • Recovery of only a million times.
  • Using VS with administrator privileges (usually I do this)
  • System restart
  • Restarting a site in IIS
  • Verify that the Active Solution configuration is set to Debug
  • Checked that in the web.config file compilation debug = "true"

Edit: I mean the razor code of course, not html or even javascript. For instance. setting a breakpoint in a foreach loop in a razor

Edit2 . I can execute the razor code if I set a breakpoint in the controller, as the debugger will view the view before it is executed. However, I still cannot set breakpoints in razor view files. The hollow circle is still showing and it will not hit.

Edit3 : Killing the β€œIIS workflow” that points to the w3wp.exe workaround is the problem. Once again, I was able to fine tune the razor's eyes. After a few hours, we will repeat the same problem again.

+6
source share
4 answers

I found that switching Build Action = Content / Compile (in the properties window) in a .cshtml file (with a built-in design) allows me to set breakpoints again .

+3
source

This is what you are looking for.

You need to compile your views at compile time, not at asp.net runtime.

fooobar.com/questions/130358 / ...

+1
source

Remember that views are actually compiled when you request a page (by default).

This means that when you set a breakpoint in the view:

  • The error "No characters" is displayed here. This means that it has not yet been compiled.
  • Shows a breakpoint. It just means that he found a SOME compiled version of the page. Like LAST working version ...

So basically this is not meaningful information to see what it says when you point a breakpoint to a point of view (at least in this regard)

If you are trying to debug this page, then you have a problem . See what the debugger outputs to your BROWSER and fix it first. I think we will be surprised at how many people will be faced with this.

0
source

In the web.config file, verify that debug = "true" in.

-3
source

Source: https://habr.com/ru/post/970698/


All Articles