Monday, August 07, 2006

Sometimes you really need to debug some part of the application but you don't want to start it. For example you want to debug some lower layer of the application and the startup time takes too long. There is a quick solution for this problem. You can use the Immediate Window from Visual Studio to start a debug session. Just type a class name (with namespace) and a method name you want to call if it is static. Otherwise you have to add a call to constructor in a form of "new" keyword. Just remember to put a breakpoint somewhere :-)

As far as I know this window is not available by default so use Debug/Widnows/Immediate to show it.

The sad thing is that it does not work for an ASP.NET project, but other than that you can use it not only for testing your own methods, but to call methods of the built in classes such as System.DateTime.Now.

Wednesday, December 06, 2006 2:38:03 PM (Central European Standard Time, UTC+01:00)
You know what would be nice then? How about a context menu entry like "Run this method"? That would make the very convenient task you're describing even easier!
John DeHope
Wednesday, December 06, 2006 3:13:21 PM (Central European Standard Time, UTC+01:00)
Actually it is possible right now. There is a tool in Visual Studio called Object Test Bench that allows you to test your object in a more visual way.
Unfortunatelly like many of the tools in Visual Studio it is sometimes inaccessible in any way. If it is there it is accessible through the Class View.
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview