The story of VB Migration Partner begins in February 2006. I was reading Upgrading Visual Basic 6.0 applications to Visual Basic .NET and Visual Basic 2005, an e-book that had been just made available on Microsoft’s site. It’s a very good source of information and is a must-read if you are involved in any VB6 migration project. In fact I suggested my Italian publishing house to translate it and I wrote a preface for the Italian edition. The book is written by Artinsoft, the company who has written the Upgrade Wizard included in Visual Studio 2002 and all subsequent editions.
While progressing in reading, however, I realized that it was possible to create an automatic conversion utility capable to translate correctly most of the VB6 syntax clauses that the Upgrade Wizard fails to convert automatically. For example, I knew how to migrate As New variables that preserve the lazy-instantiation semantics they have in VB6; how to render Declare statements containing callback or “As Any” parameters; and how to initialize UDTs that contain arrays and fixed-length strings. I also had some good ideas for converting GoSub keywords, arrays with any lower index, graphic methods, control arrays, and other “impossible” statements.
Take the problem of deterministic finalization, for example. As you may know, .NET memory management – based on garbage collection - requires that you orderly invoke the Dispose method of objects that implement the Class_Terminate event or common COM objects such as ADO Recordsets and Connections.. Why can’t a conversion program insert the call to Dispose for you before an object variable is set to Nothing or goes out of scope? Dealing correctly with disposable and finalizable objects is indeed possible, and our VB Migration Partner can prove it. (More on this on a forthcoming blog post.)
To make a long story short, I came up with a working prototype in a couple of months. It included a parser, a code generator, and a support library that could handle the most common keywords and controls. It was the evidence that the approach was promising, thus I abandoned most other activities and decided to focus mainly on the new tool. I rewrote the syntax analyzer – the most delicate portion of a conversion tool – from scratch, added code metrics and analysis features, completed the support library with new controls. Before long Marco Bellinaso joined the team and got in charge of the user interface module and of assessment features. Marco is a renowned writer and the author of best-selling ASP.NET books and of one of Microsoft’s official starter kits.
In spring 2007 we set up the test team, lead by Giuseppe Dimauro. Giuseppe is Code Architects’ co-founder as well as one of the two MSDN Regional Directors in Italy (the other being yours truly), and is also responsible for our consulting services. Since then the group has worked on hundreds of VB6 apps, stressed virtually every single VB6 feature, and tested the tool on many real-world business software from our Italian customers. The samples you can find here are just a little portion of what we’ve used in our tests.
In these two years we have bumped into some of the most weird bugs I ever faced in many years, and solved so many technical problems that range from trivial to overly complex. We learned how to convert some of VB6’s most esoteric features, such as ADO bindable classes or user controls with OLE_OPTEXCLUSIVE properties (ever heard of them?). We also realized that there are more undocumented differences between VB6 and VB.NET than documented ones. Perhaps we’d never started this project if we had known how complex it would have turned to be, but now we’re just very happy that we were so ignorant.