views:

82

answers:

2

I'm working with a BasePageClass that derives from System.Web.UI.Page.

What I'd like to do is somehow set a break point for every single time a method or property on this page is accessed.

The only way I know how to do this is set up a breakpoint on every property and method on the page. This just doesn't seem practical.

Does anybody know if there is a way to just say "whenever code on this page is executed, break on it"?

A: 

Not completely sure about this...

But I think when you use conditional breakpoints in Visual Studio, you can pretty much have the breakpoint set to evaluate any expression that you can write in .Net. Maybe try writing some Reflection code that checks to see if a property or method has been called, and then set your breakpoint condition to eval that code.

matt_dev
+1  A: 

System.Diagnostics.Debugger.Break()

"If no debugger is attached, users are asked if they want to attach a debugger. If yes, the debugger is started. If a debugger is attached, the debugger is signaled with a user breakpoint event, and the debugger suspends execution of the process just as if a debugger breakpoint had been hit."

-- http://msdn.microsoft.com/en-us/library/system.diagnostics.debugger.break.aspx

Take a look at this, you may be able to use it on conjunction with a BasePage, or some other goodness.

vfilby