10 Steps to follow during VB6 to .NET migration

Converting VB6 code to .NET is not a simple process and cannot be executed easily, even if using automation tools. A lot of automation tools are available for this, including solutions by Microsoft. 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 we can use VB.NET’s Upgrade Wizard that automatically converts all the syntaxes, which is just half the work done. It leads to other problems and errors during compilation that automatic conversion tools do not handle. During migration, we need to rewrite and rearchitect the codes to take maximum advantage of VB.NET’s new tools.

vb6 to .net migration

.NET migration 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. 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. 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. Migration – This involves creating a SQL Server or database and importing data and resizing the database structure.

7. Compilation – Compiling the project gives a list of compilation errors and runtime errors that need 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. QA – The Upgraded application will be subjected to different levels of testing throughout the process to ensure the reliability and correctness of the application.

  • Unit test thoroughly each item converted to help identify any flaws in implementation.
  • Perform system testing to ensure the application functionalities are met in the .NET framework version.
  • Import final version legacy data and perform load testing to ensure the application works in the .NET environment.

10. Deployment – Finally deploy to the 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 the COM reference counting mechanism. While in VB.NET, the job of clearing unreferenced objects is done by the 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 leads 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.

August 27th, 2018|Technical|