Create an Account
username: password:
 
  MemeStreams Logo

MemeStreams Discussion

search


This page contains all of the posts and discussion on MemeStreams referencing the following web page: ASP.NET Internals Spelunking. You can find discussions on MemeStreams as you surf the web, even if you aren't a MemeStreams member, using the Threads Bookmarklet.

ASP.NET Internals Spelunking
by Worthersee at 4:37 pm EST, Jan 23, 2008

When I wrote the ASP.NET book I pretty much lived in Reflector 24/7 to figure out all the gory implementation details. Back then it would have been great to be able to simply set breakpoints in some of the low level classes like HttpRuntime or modules.

Fortunately this is now possible, here's a quick walkthrough:

* Set up your Visual Studio to work with the new .NET symbols. Also have a look at the various symbol loading options you have.
* Open an ASP.NET app
* Set a breakpoint somewhere in your code (e.g. in a Page_Load)
* Let the debugger hit the breakpoint
* Open the call stack window and navigate up the stack, e.g. to HttpRuntime.ProcessRequest or Page.ProcessRequest
* Set a breakpoint (use HttpRuntime.Init or the (c)ctor to step through the whole initialization process)
* Right click the breakpoint, select location and check the "Allow the source code to be different from the original version" option.
* Debug again. The debugger should now hit the breakpoint in the ASP.NET infrastructure class
* Depending on how early in processing you set the breakpoint, you may have to recycle the AppDomain to start over. Simply make a change to web.config and save to trigger recycling.

This is a reminder for me to try again at getting ASP.NET Regex Validators to fail. I tried a few months ago while waiting at the airport for my connecting flight. Other than making the Regex.Match thread hang with backtracking I was unable to make the regex validator fail.

I was only poking around with Reflector before, but thanks to Dominick Baier for reminding me that I can now hook a debugger to the code I previously couldn't.


 
RE: ASP.NET Internals Spelunking
by Acidus at 10:10 pm EST, Jan 23, 2008

Worthersee wrote:

I was only poking around with Reflector before, but thanks to Dominick Baier for reminding me that I can now hook a debugger to the code I previously couldn't.

Bryan did some work with Silverlight where he could decompile the assemblies, and load them in Visual Studio 2005. There is a option where the source code lines of breakpoint must match exactly (something along those lines). By disabling that option, Bryan and I got Silverlight assemblies running in a debug mode in VS2005.

Not quite the same as setting break points in the CLR, but it shows that you can uses reflector + VS voodoo to debug any .NET assembly with various degrees of success.


 
 
Powered By Industrial Memetics