Set breakpoint in cshtml view

Topics: General
Feb 19, 2011 at 7:45 AM

I want to see what the value of the ViewData["PasswordLength"] is in debug, but I find it's impossible set the breakpoint on this line in Visual Studio 2010. Anyone can give some advise? Is there any handy debug tool to do this?

<p>@T("Passwords are required to be a minimum of {0} characters in length.", ViewData["PasswordLength"] as string)</p>

I know a stupid resolution, but it's not satisified, I think.

    string t = ViewData["PasswordLength"].ToString();


Feb 19, 2011 at 2:53 PM

Sometimes i can only debug a view when using IE and it has been rendered at least once while in debug.

Stepping into often works better then a breakpoint in the view.
Set a breakpoint in your controller returning the ActionResult and step into.

PS: Why are u still using the ViewData?
I prefer strongly typed views myself, if i've to use weakly typed views then i rather use in MVC3 introduced dynamic ViewBag