Is it possible to set breakpoints in razor views with servicestack?

I am trying out the new razor view stuff in service stack, and I have this view:

@inherits ServiceStack.Razor.ViewPage<ServiceStackRazorCrud.Api.UserPageResourceResponse>
    var m = Model;  // <-- I have a breakpoint in this line.
    var req = Request; 
    var res = Response;

When I set a breakpoints and run the application (console application) I can see that the view is compiled but the debugger does not break when I request the view in the browser. I assume that this is because the views are compiled dynamically at application start or something like that. Is it possible somehow to get the breakpoints to work?


AFAIK it's not possible to debug views this way (currently using 3.9.43, later version I believe has better diagnostics for compilation errors).

Try and keep view code simple, restricted to simple loops/rendering and using extension methods on DTO's for any complex logic/processing, which do allow debugging. You might also consider utilizing logging, or a simple Debug extension method:

using ServiceStack.Html;
public static class HtmlHelperExtensions
    public static bool IsDebug(this HtmlHelper htmlHelper)
    #if DEBUG
        return true;
        return false;

@using ServiceStack.Text
@inherits ServiceStack.Razor.ViewPage<ServiceStackRazorCrud.Api.UserPageResourceResponse>
    var m = Model;  

@if (this.Html.IsDebug())
    <div class="debug">@(this.Model == null ? "m == null" : Model.Dump())</div>

Need Your Help

Having images as background of JPanel

java swing background jpanel paintcomponent

I am new in Java and I am currently creating a game with graphics. I have this class that extends from JFrame. In this class, I have many JPanels that needs an image as background. As I know, to be...

How does iterative deepening affect time complexity?

algorithm big-o depth-first-search tree-traversal iterative-deepening

I have a tree traversal algorithm which generally operates in O(bm) where b is the branching factor and m is the max depth.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.