Edit and continue with ASP.NET

Many developers don’t realize that they can do edit and continue (EnC) when developing ASP.NET applications with Visual Studio .NET 2003. And it doesn't matter if you are using Visual Basic .NET or C#.  It's pretty close to EnC anyway. And it gets even better in Whidbey.

How? By using attach / detach in Visual Studio 2003.

Say you are deep down debugging a web app and an error occurs on your postback. Now, to fix the bug you don’t have to stop the debugger, you simply go to the debug menu and select Detach all. You can now edit the code, build, and select Debug -> Processes. Check the ‘Show system processes’ checkbox, select the ASP.NET worker process (aspnet_wp.exe) and attach.

You can now hit refresh in the browser and voila, you are back in business without having to start all over again. Note that you don’t have to start out by debugging. I often prefer to start without debugging and attach when I need to.

This gets better in Whidbey since you don’t have to compile the code-behind to a DLL.  You don’t even have to detach / attach. With Whidbey, simply 

  • Start out by debugging
  • Edit the code
  • Save the file
  • Hit refresh

Nice, or what?

At the NNUG/MSDN event I have demoed the return of Edit & Continue in Visual Basic .NET Whidbey. Someone in the audience even said they would not move to .NET before this feature is back (talking to him offline revealed that he was already using .NET).

For me this is mostly an issue with Windows Forms development where you may be deep in an application debugging. Fixing the bug and coming back to the place where the error occurred may take a significant amount of time. Windows Forms apps are not the fastest to start up ;-) and getting back to the same place and state can take a long time.

Since C# probably will not get EnC, maybe VB.NET will be the language of choice for Windows Forms development? Having done some Office integration lately and now working with VB.NET in Whidbey has put VB.NET in a new perspective for me.

No Comments