问题描述:

About once every 20 page loads, I get a glitch in my View. I'd like to know what values the variables in my Controller contained right before it called the View. However, once the View is called I lose all local variables from the Controller. Is there any hope?

网友答案:

Use ModelVisualizer Helper in mvc.contrib It renders all values into the view.

网友答案:

The watch window's "Make Object ID" feature will let you watch variables which are out of scope.

网友答案:

You could add extra output on your view page to show you variable value / states for debugging information until you resolve the issue.

网友答案:

Apologies if I'm missing something obvious but can't you set a conditional breakpoint in the Controller just prior, or on, the View call? The condition can be based on execution count. Once stopped you can step into the View.

I realize you lost the Controller local variables as they are out of scope as soon as you step into the View but can't be that hard to write them down, append to a large string (ie Flash message) and output in view, etc.

相关阅读:
Top