2

I am trying to debug a MVC widget in sitefinity 8 but the debugger doesn't hit the breakpoint. The widget works but I cannot debug it. What is wrong? It seems like sitefinity compiles the widget first then renders the compiled one at run time. Am I right? How can I get to breakpoint?

Edit:

The debugger actually hit the breakpoint if the code is inside controller. But I cannot debug into view's (cshtml file) code.

Behrooz
  • 243
  • 2
  • 14
  • Hi Behrooz, I don't know how to debug the view in Sitefinity. But if you are doing this question, you may be doing your logic in the wrong place. remember that MVC Stands for Model, View and Controller. So your Logic should be in the Controller and the view should be used just to display the values of your model – Nelssen Feb 29 '16 at 14:47
  • @Nelssen you are right, the logic is in the controller not in the view. I am quite familiar with MVC but something was unexpected on the view level so I wonder if I could debug at view level. MVC in many commercial CMSs is not implemented exactly like standard and organic MVC architecture. They do all sort of tricks to inject an MVC component into non-MVC architecture.... Anyway I already figured out the problem, so I don't need to debug the view anymore. Thanks. – Behrooz Mar 01 '16 at 03:04
  • Hey! yeah you are also right regarding injecting MVC component into a non-MVC architecture, but i think it was a nice effort though. no prob! cheers – Nelssen Mar 01 '16 at 10:21
  • Not answers the question, but tells you how to disable view precompilation: http://knowledgebase.progress.com/articles/Article/How-to-turn-off-precompilation-of-Razor-views-in-Sitefinity-Feather – Andrey Stukalin Aug 11 '16 at 07:52

2 Answers2

1

Sitefinity is caching your views. If you want to debug the view, make sure to let the breakpoint hit it the very first time.

leondepdelaw
  • 51
  • 2
  • 6
  • yeah, i felt it is caching the views but I was not sure. How can I stop sitefinity from caching mvc views? will disabling at page level work for the widget views as well? – Behrooz Apr 12 '16 at 04:09
0

He Behrooz,

you can turn off the Caching for the page you drag widget:

Page -> click on "Action" -> "Titles and Properties" -> scroll down to "Advance Tab" -> add choose Caching Options is "No Caching".

You can see the image attachment for more details.

Binh LE
  • 387
  • 5
  • 17