By Nellaiappan L | October 4th, 2016 |
Converting VB6 code to VB.NET is not a simple process that can be executed easily in spite of using automation tools. A number of automation tools are available in the market, with Microsoft itself being shipped with Visual Basic Upgrade Wizard. Some of the major changes undergone in VB6 is in the Common Language Runtime (CLR) new programming model. To reap maximum benefit out of the new features and structures of VB.NET, it is advisable to rewrite major sections of the application than porting it. Since this is a tedious process you can use VB.NET’s Upgrade Wizard that automatically converts all the syntaxes, which is just half the work done. No sooner you will be faced with other problems and errors during compilation that won’t be handled properly with the Upgrade Wizard. During migration you will have to rewrite and rearchitect the codes to take maximum advantage of VB.NET’s new tools.
.NET migration is a complex process that requires strict adherence to the features and syntactical aspects of the programming language. Here we list some of the essential steps that need to be considered while migrating from VB6 to VB.NET.
1. Application Assessment – Perform a thorough assessment of the application to be upgraded. You can document the existing system functionalities, which may be a tedious process. Use an assessment tool to analyze the VB6 application to understand issues and estimate the approximate cost and effort.
2. Planning and Preparation – Prepare project plan, determine scope and migration requirements by elucidating maximum information about the application. Create functional requirements for the new framework and application.
3. Upgrade Strategies – Develop a migration strategy after brainstorming the application requirements. First you need to get the VB6 application into the new .NET platform with the existing functionality then perform incremental changes to incorporate new functions.
4. Automatic Upgrade Process – After automated migration the quality of the generated code needs to be improved. This involves removing duplicated code, upgrading problematic syntax and controls, fixing data declarations, and the like.
5. Manual Upgrade Process – It is essential to rewrite critical application logic to suit the .NET framework and those that have not been properly converted during automation. You can continue writing new code in VB.NET leaving the bulk of the existing code in VB6 as there is good interoperability between VB6 COM components and VB.NET components.
6. Migrate Data – This involves creating a SQL Server or database and importing data and resizing the database structure.
7. Compiling – Compiling the project gives a list of compilation errors and runtime errors that needs to be analyzed and fixed through an iterative process.
8. Fixing Errors – Bugs can be tracked using various source code analyzers that helps identify duplicate codes and fix data declarations.
9. Quality Assurance – Upgraded application will be subjected to different levels of testing throughout the process to ensure reliability and correctness of the application.
10. Deployment – Finally deploy to application server and verify the checklist of all the components and functionalities in the application tally.
Another aspect that developers should keep in mind during VB6 to .NET migration, is the difference in the procedure by which objects are cleared from memory. In VB6, object instances are cleared using COM reference counting mechanism. While in VB.NET, the job of clearing unreferenced objects is done by garbage collector. Garbage collection helps in establishing a compact memory in use. Developers utilize the method Collect in GC class to perform garbage collection. However, calling the garbage collector explicitly leads to suspension of all threads before triggering the garbage collection that lead to performance issues. So the implicit method invoke is always recommended.
Migrating VB6 to .NET is definitely the way to go with rapidly changing programming landscape. Migration puts forth some challenges that can be overcome with automation tools, source code analyzers and proper planning by only upgrading sections relevant from a business point of view. Here at Macrosoft we have a proven track record of successfully migrating business-critical applications, which are executed by a dedicated team of developers experienced in both VB6 and VB.NET environments.
For more information related to .NET migration and services, continue reading our blogs.