An ISV insight into the CLR and .Net framework 2.0 features

This was my first webcast, so please be patient through the beginning. It gets much better there after. Participants polled, thought so :-)

The primary theme of this webcast was to show how much the developer division has embraced the community through openness and solicitation of product feedback. It is our sincere desire to have the community driving product features, so please send me anonymous or non-anonymous feedback on this blog via comments or email.

The presentation covered the following Visual Studio 2005 subjects.

· Community

· SQL server integration

· 64bit

· Performance

· Stability

· Improved IDE

· Office programmability


I also touched on what's coming in the next two ISV webcast's.

· Visual Studio Tools for Applications description. Webcast.

· The WinFX Add-in model description. Webcast.

A description of the areas I showed in the webcast and sample code I demonstrated, may be found by clicking on the links below.

FTP, Console, Gzip compression sample code

I showed some v1.x code from an MSN application we wrote (Shuttle), were we utilized WebRequest functionality to roll our own FTP implementation. Although rich support for HTTP was provided in BCL 1.x over WebRequest and friends, FTP was not part of the BCL until 2.0.

This was an example of functionality a customer may write in their utility or helper classes that we could/should recommend for inclusion in the platform. It just so happens that I worked with the BCL team in building the MSN FTP implementation and the further inclusion into the CLR 2.0 product.

32/64bit sample code

· Sample code showing what platform (32/64bit) you are running on.

· Managed code can call into a native dll.

· Shows C# code making a Win32 dll call to open and read a file using a platform agnostic pointer.

· VS project properties

· Verifiable managed binaries just run on 64bit. See the platform target selection.

· Check the unsafe code, checkbox, for this sample code, since we are using the unsafe keyword for code that requires a pointer (a native code concept).

Network Information sample code

· Simple Ping

· ShowInterfaceSummary

· ShowTcpConnectionStatistics

· ShowInboundIPStatistics

Performance enhancements

· Leightweight Code Gen (LCG)

· Use the DynamicMethod class to generate and execute a method at run time without having to generate a dynamic assembly (AssemblyBuilder) and a dynamic type (DefineDynamicModule, DefineType)to contain the method. Dynamic methods are the most efficient way to generate and execute small amounts of code.

· TryParse

· I showed old code where I used RegEx (Regular Expressions) to validate if a string was an Int, Double, etc.. Value type.

· The good news was that the RegEx's I wrote in Perl just worked in .Net

· The bad news was that my performance characteristics for parsing large text files was suboptimal.

· I found that trying a convert the string to the type I expecting, was more performant, but programming by exception is a bad design pattern as exception overhead is costly.

· By using TryParse you can avoid exceptions and still validate the data type.

· This was an example of feedback we would like to receive on perfromance enhancements based upon your scenerio's.

· StopWatch

· A simple class used for timing.

· Another example of a utility class most people write themselves.

Leveraging the Platform

· I showed Office Programmability in the Visual Studio Tools for Office (VSTO) product where I wrote simple C# code behind an Excel Spreadsheet.

· I showed the IDE power of Hosting Excel as a designer in VS where I drag/drop a managed control onto the spreadsheet.

· I also used this simple example to show partial classes.

· A 2.0 feature that allows a class to span multiple physical files.

· In this example I showed ISV's how they could show simple user code for their developers in a partial class and hidden designer code in a separate file.

· I showed ENC where I stopped on a breakpoint, added code, and continued to run.