Generated code and breakpoints

Dec 9, 2011 at 1:53 AM
Edited Dec 9, 2011 at 1:54 AM


I'm getting some weird behaviour after using RazorGenerator. I've generated the code for a number of views and they remain in the web project. The weird behaviour relates to breakpoints to determine if the pre-gened views are actually being used e.g. If I set a breakpoint in both the Index constructor and the ViewBag.Title line in the Execute method below:

[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "")]
public class Index : System.Web.Mvc.WebViewPage<dynamic>
        public Index()
        public override void Execute()

            #line 1 "..\..\Views\Admin\Index.cshtml"
            ViewBag.Title = "Administration";

and then browse to the Admin page then the constructor's breakpoint is hit but the execute method never is. The page renders successfully.

Conversely, in other pages, the constructor is never even hit. The PrecompiledMvcEngine is registered successfully on the start of the web app. Any ideas what's causing this behaviour?



Dec 9, 2011 at 5:18 AM

Most likely it's the line pragma doing its thing. Trying setting a BP in the cshtml instead.

Dec 12, 2011 at 2:04 AM

Cheers David indeed it is. Thanks.