Search code examples
visual-studiodebuggingrazortemplate-engine

Is it possible to set a break point in a Razor template?


Is it possible to set a break point in a Razor template? One might argue that a template should be so "dumb" or "minimal" in it's logic that you should never have to debug them -- which might be valid. However, I don't think there is anything in Razor to prevent templates from being abused in some fashion, so eventually a template might need to be dubugged.


Solution

  • You can indeed set a break point in a Razor template. And regardless of the "dumbness" of your view, it will unavoidably, if usefully, populate the view with values which you can debug as needed. Another reason to love you some ASP.NET MVC.