New Features - Part 1
Visual Studio .NET 2003 is an evolutionary upgrade to Visual Studio .NET 2002, where as Visual Studio .NET 2002 was a revolutionary upgrade to Microsoft’s entire development platform for Windows and the web. Let’s start with what Microsoft has improved upon or fixed from Visual Studio .NET 2002.
Intellisense and Code Completion Improvements
Microsoft has improved intellisense in several areas. First, intellisense now has support for attributes. While in Visual Studio .NET 2002, intellisense allowed you to get the name of the attribute in question, it would not fill in any arguments or property options. They’ve fixed this oversight in Visual Studio .NET 2003, and it now allows you to perform complete intellisense on the entire attribute, just like any other code. Below is an image of me adding the StructLayout attribute to a struct using intellisense.
Another improvement to intellisense in Visual Studio .NET 2003 will be very welcomed by C# developers. Visual Studio .NET 2003 will now automatically fill in event handler code when you type the “+=” operator after an exposed event. VB.NET developers won’t be quite as excited, as adding event handlers in VB.NET is simpler (although less flexible) than in C#. Below is a screen shot of the new intellisense support for event handlers.
Notice that Visual Studio .NET 2003 automatically picked the method in the current class (Form2.btnHelloWorld_Click) that matched the event handler’s signature. If there was more than one match, it would have allowed me to select which method to register the handler for, similar to how overloaded methods are shown by intellisense.
Visual Studio .NET 2003 will now insert stub code for interfaces and abstract methods of classes from which you implement or inherit in a much more fluid manner. This is incredibly useful and saves both the time it takes to type in all the methods, and the time it takes to look them all up in the documentation. Visual Studio .NET 2002 allowed you to do this by creating your class, going to the class view, right clicking the interface or class name, and selecting “implement interface…”. For this reason, many developers had no idea you could do this, much less took advantage of this great feature.
In Visual Studio .NET 2003, you simply have to hit TAB after you’ve typed in the name of the class or interface your implementing or inheriting from, and Visual Studio .NET 2003 takes care of the rest. Below are two images. The first shows the ToolTip that informs me that I can hit tab to insert the stub code, and the second shows some of the stub code that was inserted.
Notice that the inserted code is grouped into regions by what interface it came from. This is really great, especially for implementations of interfaces like ICollection, which have many methods.
In addition to automatically stubbing out code for interfaces and abstract methods, Visual Studio .NET 2003 now will show a list of overridable methods when you type “public override ”. Just like the stub code generation, this dramatically cuts down on your trips to the documentation or to class view to figure out what the method signature is. Below is an image showing the intellisense list of overridable methods and properties for the System.Windows.Form class.
Another great intellisense improvement in Visual Studio .NET 2003 is the “most recently used member” feature, or MRUM. Visual Studio .NET 2003 keeps track of which members of a class you use most often, and makes them the default intellisense member for that particular class. For instance, if you use the “Text” property of the TextBox class often, it will be the default option in the intellisense popup that appears, instead of “AcceptsReturn”.
For you VB.NET developers, there is an intellisense improvement that is only available to you. (I guess you guys need all the help you can get, right? J Relax, I’m just kidding.) If you type “Try” and hit enter, Visual Studio .NET 2003 will automatically fill in the Catch and End Try portions of the statement.
The problem is, Visual Studio .NET 2003 adds the catch all “Catch ex As Exception”. Last I checked, you’re never supposed to catch “Exception” like this. Not only will you catch all the exceptions your code could ever possibly generate, but you will also catch exceptions from the garbage collector, the core runtimes, and a lot of other places you should not be catching exceptions from. (Or, rather, catching exceptions and swallowing them.) Microsoft should have, at most, filled in something like “Catch ex as ApplicationException”, but even that makes me uncomfortable. In my opinion, this feature only encourages sloppy programming.
try/catch intellisense feature would have been to automatically go through
all the code within the try block and determine all the exceptions that code
explicitly throws, and then give you an overloaded list of exceptions in the
catch statement. This would have been incredibly useful, and would have
encouraged good error handling.
We missed ya buddy! Welcome back.
As I mentioned, Visual Studio .NET’s debugger is the best there is. That said, there is always room for improvement. There were a few very tedious debugging tasks in Visual Studio .NET 2002, the most tedious of which was when you were attempting to debug complex collection objects.
The problem was that many collection objects store their actual objects deep within their internal object hierarchy, and in order to get at the actual elements inside the collection, you needed to dig down into the members of the object until you found them. Sometimes, you could get lost in a self-referencing endless loop of members. It was very frustrating. Visual Studio .NET 2003 solved this problem (I think) by modifying Visual Studio .NET 2003’s debugger so that it could recognize certain collection types (like Hashtable, for instance), and skip right to the elements of the collection instead of forcing you to dig down. Below are two images. The first one is of Visual Studio .NET 2002’s handling of debugging a Hashtable, and the second one is of Visual Studio .NET 2003’s handling of that same Hashtable.
Notice how Visual Studio .NET 2002’s Hashtable exposed not a simple list of elements, but the fairly complex inner collections that needed to be each search to find the elements you were looking for. This becomes exceedingly difficult when you’re dealing with collections of hundreds or thousands of elements, or when you’re dealing with complicated collection classes like DataSets and DataTables. As you can see, Visual Studio .NET 2003 takes a shortcut, and just shows you the information you’re almost certainly interested in anyway.
Web Services Improvements
As previously mentioned, the .NET Framework v1.1 now comes packaged with the WSE (Web Service Enhancements), which include support for WS-Security, WS-Routing, WS-Attachments, and DIME. (Information on all of these can be found here.) Along with this additional functionality, Microsoft decided to fix what was quite possibly the ugliest dialog in any Microsoft product ever. That’s right folks; there is a new “Add Web Reference” dialog.
Gone is the clunky beast from Visual Studio .NET 2002. It has been replaced with a much more esthetically pleasing, and more functional, dialog. Below is an image of the dialog when it is first opened.
As you can see, the new dialog has better integration with UDDI (offering both local and remote UDDI searching), as well as letting you easily view all the web services on the current machine. Below is an image of what is shown when you click on the “Web services on the local machine” link. I’ve blurred out some text because I’m working on several “top secret” projects. J
In Visual Studio .NET 2002, if you wanted to add your web service proxy class to anything other than the “com.somedomain.www” or “localhost” namespace, you had to add the reference, then go manually change the namespace. Now you can enter that information before adding the reference, as is shown below.
The new dialog also performs an XSL transformation on the WSDL for any web service you select, and presents the information in a much more pleasing format.
Of course, you
can always view the straight XML that makes up the WSDL by viewing it in
your browser instead of within the web reference dialog. You can also right
click inside the WSDL display window and select “View Source”.