ArtinSoft's Blogs

Software Migration Experts
Welcome to ArtinSoft's Blogs Sign in | Join | Help
in Search

Jose Aguilar's Blog

All things migrations, software and technology

February 2009 - Posts

  • One More Time – VB6 runtime supported on Windows 7

    This week Microsoft updated its support statement for Visual Basic 6.0 to include the upcoming Windows 7. Even though the original idea was to not support VB6 in Windows 7, given the outstanding demand, the runtime WILL BE included in the OS.

    To summarize, the support status of the different Visual Basic 6.0 components is:

    • Visual Basic 6.0 IDE: Unsupported as of April 8, 2008.
    • Visual Basic 6.0 Runtime: Supported for the lifetime of Windows Vista, Server 2008 and 7. *This is the big change in the Support Statement*.
    • Visual Basic 6.0 Runtime Extended Files: The supported versions are here.

    Even though the runtime components will be supported in Windows 7, it is important to consider the implications of the IDE not being supported (as I described in this post). There are also additional advantages of moving to .NET such as 64-bit support (VB6 apps are 32-bit only) and all the productivity, maintainability and deployment gains provided by the platform.

  • Efficiently Migrating 5 Million Lines of Code from VB6 to C#: Citigroup – Banamex Case Study Now Online

    This week we published a new case study on the migration we performed for Banamex, part of Citigroup and one of the largest Mexican banks. In this project we migrated 124 Visual Basic 6.0 and ASP applications from different divisions of the bank to C# and ASP.NET. All in all, we migrated over 5 MILLION LINES OF VB6 AND ASP CODE. This is the largest VB6 to .NET migration we’ve done so far, it was a huge success story – so much that we are now working on the migration of some other applications that weren’t originally included in the scope of the project.

    You can read the details here.

  • Visual Basic Upgrade Companion DE Trial Download Now Available

    A quick post to let you all know that we now have a trial available for download of the Visual Basic Upgrade Companion Developer Edition. To obtain the trial you need to fill in your information here, and we will email you the download link and the necessary licensing information to activate the trial.

    The trial will allow you to migrate up to 2,000 lines of code simultaneously, and has a limit of 10,000 lines of code total – which means that every time you migrate some code, the amount of lines you migrated are discounted from the 10,000 total.

    So don’t wait and download the VBUC DE trial now!

    Remember that you can also request a trial for the Enterprise Edition of the Visual Basic Upgrade Companion at this page. You will need to run the Assessment Tool first, and based on the results we will send you a custom trial for a portion of your application.

  • Migrating Enumerations to .NET

    Several times I’ve mentioned the Type Inference feature of the Visual Basic Upgrade Companion. The main objective of the component that we call the “Typer” was to eliminate Upgrade Issue 1037 (Couldn't resolve default property of object ‘x’) that appeared then the VBUC wasn’t able to correctly determine the data type of a variable and consequently couldn’t resolve its default property.

    Even though dealing with EWI 1037 was the design goal, having a typing mechanism in the VBUC allowed us to improve a great deal of transformations. One particular feature that benefitted from it was the migration of VB6 Enums. To illustrate this, let’s look at an example.

    First, let’s see some VB6 code (doesn’t really do much except use Enums):

       1:  Public Enum Myenum
       2:     EnumValue0 = 0
       3:     EnumValue1 = 1
       4:     EnumValue2 = 2
       5:     EnumValue3 = 3
       6:     EnumValue4 = 4
       7:     EnumValue5 = 5
       8:     EnumValue6 = 6
       9:     EnumValue7 = 7
      10:  End Enum
      11:   
      12:  Dim enumUsage As Integer
      13:   
      14:  Public Sub MyMethod()
      15:  enumUsage = EnumValue1
      16:  enumUsage = 4
      17:  If enumUsage = EnumValue4 Then
      18:      enumUsage = EnumValue7
      19:  End If
      20:  If enumUsage = 7 Then
      21:      enumUsage = 5
      22:  End If
      23:  End Sub

    After running the code through the VB Upgrade Companion we get this:

       1:      Public Enum Myenum
       2:          EnumValue0 = 0
       3:          EnumValue1 = 1
       4:          EnumValue2 = 2
       5:          EnumValue3 = 3
       6:          EnumValue4 = 4
       7:          EnumValue5 = 5
       8:          EnumValue6 = 6
       9:          EnumValue7 = 7
      10:      End Enum
      11:   
      12:      Dim EnumUsage As Myenum
      13:   
      14:      Public Sub MyMethod()
      15:          EnumUsage = Myenum.EnumValue1
      16:          EnumUsage = Myenum.EnumValue4
      17:          If EnumUsage = Myenum.EnumValue4 Then
      18:              EnumUsage = Myenum.EnumValue7
      19:          End If
      20:          If EnumUsage = Myenum.EnumValue7 Then
      21:              EnumUsage = Myenum.EnumValue5
      22:          End If
      23:      End Sub

    The VBUC performs some very subtle transformations to improve the quality of the generated code. Let’s look at them in detail:

    First of all, the usage pattern for the variable EnumUsage is analyzed by the Typer, and it determines that it is always used to store a value of the Myenum Enum. Thus, it infers that the correct data type should be Myenum instead of Integer, as seen in line 12:

      12:      Dim EnumUsage As Myenum

    Since the Typer keeps track of the different ways in which a variable is used, and of the values that are assigned to it, it provides information to the VBUC so it can replace the assigned values with the corresponding enumeration. This applies even for comparisons – the code is translated from:

      16:  enumUsage = 4
      ...  
      20:  If enumUsage = 7 Then
      21:      enumUsage = 5

    to (notice the if in line 20):

      16:  EnumUsage = Myenum.EnumValue4
      ...  
      20:  If EnumUsage = Myenum.EnumValue7 Then
      21:      EnumUsage = Myenum.EnumValue5

    This is just one of the features that we have worked on over time to improve the quality of the code generated by the VB Upgrade Companion. It was built on top of the functionality provided by the Typer, and works with both VB6 built-in and user-declared enumerations. As shown in the example, this makes the code easier to maintain, and even looks as if it was written originally in .NET. :)

  • Fix for IE7 crash when checking out documents from SharePoint Services

    I know this is completely off-topic to what I normally blog about, but I’ve been having problems this past couple of days when trying to checkout a document from SharePoint using Internet Explorer 7. It crashes every single time – which has been a very frustrating experience, to say the least. I have no idea what caused it to (mis)behave this way. Anyway, turns out the fix was incredibly easy:

    1. Close all IE7 Windows
    2. Run Microsoft Office Diagnostics from Start->Programs->Microsoft Office->Microsoft Office Tools
    3. Click on Run Diagnostics, wait a few minutes, and you should get a dialog saying that 1 repair was performed:




    4. Continue using SharePoint normally

    FYI, I am using MS Office 2003 and Windows SharePoint Services 3.0.

    Posted Feb 10 2009, 10:10 AM by Jaguilar with 2 comment(s)
    Filed under:
  • How to Get Your Feet Wet Before Jumping to .NET

    As a Visual Basic 6.0 developer you may want to become yourself familiar with the .NET platform before putting it into production (and making the corresponding investments). In this blog post I wanted to give some pointers to commonly used resources that can help you in that regard.

    To run one of the latest Microsoft operating systems you can take advantage of the VHD Test Drive program that I blogged about some time ago. Through this program you have access to a large number of OS configurations that you can try out for a limited time. The ones I would recommend to get started are the Windows Vista 30-Day Eval VHD, the Windows Server 2008 Evaluation, and the Microsoft Windows Server 2003 R2 Enterprise Edition VHD. Remember you need either Virtual PC, Virtual Server or Hyper-V in order to run the virtual machines.

    You’ll also need to install Visual Studio 2008, and for this you can either install the Express Editions (which have some limitations, but are free), or a 90-day trial version of Visual Studio 2008 Professional Edition or Visual Studio Team System 2008 Team Suite. Another alternative is to download a full virtual machine with Visual Studio Team System 2008 Team Foundation Server installed.

    Also, to get familiar with specific .NET features, you can take advantage of the free e-book offer and the additional content currently up at Microsoft Visual Studio 2008 Learning Portal.

  • VBUC vs. the Upgrade Wizard: A Short Recap on the Advantages of Using the Upgrade Companion

    Because of some queries we’ve had in the past few days, I think it is time to revisit the differences between the Upgrade Wizard that ships with Visual Studio .NET (2003,2005 & 2008) and the Visual Basic Upgrade Companion (VBUC). The VBUC is a different product, with very different capabilities than the Upgrade Wizard. We have a detailed comparison over at the Visual Basic Upgrade Companion vs. Upgrade Wizard page, but here is a brief overview of the main differences:

    • C# Generation: The Visual Basic Upgrade Companion  is able  to generate C# directly  from  the Visual Basic 6.0 source code, as an alternative to Visual Basic .NET.
    • Structured Error Handling: The Visual Basic Upgrade Companion includes features to remove unstructured “spaghetti” code and replace it with structured flow control statements in .NET. All unused labels are removed from the  resulting code. Plus  the most commonly used  “On Error  ” patterns are currently  recognized and replaced by the tool. This is important for C# migrations, as it ONLY supports structured error handling.
    • .NET Native Libraries: Instead of upgrading VB6  code using  the Visual Basic Compatibility  Libraries  like  the Upgrade Wizard  does,  the  Visual Basic Upgrade Companion  promotes  the  use  of  .NET  native  libraries whenever possible.
    • Type Inference: The VBUC contains a typing system that accurately assigns correct .NET data types to existing VB6 variables, functions, fields, parameters, etc
    • Stub generation: To ease the compilation process, the Visual Basic Upgrade Companion generates an empty declaration (stub) in a stub-dedicated source code file and into the converted project for each library element which occurs in the original application and does not have an equivalent in .NET. All the references to these not-converted elements are translated into references to their corresponding stub declarations.  This strategy does not fully resolve the lack of .NET equivalent elements, since the stubs will require manual implementation, but, it saves an important amount of time during the manual changes stage.
    • Code quality enhancements: The VBUC generates higher quality code with more mature and exact transformations. These transformations include data  type enhancements and grammar pattern transformations and detailed code improvements. A detailed explanation of these transformations can be found on the VBUC vs. UW page.
    • Multi-Project Conversion: The Upgrade Wizard is able to convert one single VB6 project file (*.vbp) at a time. Hence, if the user wants to upgrade a complex VB6 application with this tool, several considerations must be taken in order to accomplish full functional equivalence. The Visual Basic Upgrade Companion allows the conversion of multiple Visual Basic 6.0 projects. It performs a separation between the pre-processing and migration stages in order to fix problems like the use of by-ref parameters, interfaces, renaming and typing among the different projects. The pre-processor environment solves the references among projects and simplifies the overall migration process.
    • .NET Enumerations: Another  important Visual Basic Upgrade Companion  feature, absent  in  the Upgrade Wizard,  is the replacement of numeric literals assigned to several control properties with .NET enumeration equivalents when  possible,  so  that  the  generated  Visual  Basic  .NET  code  is more  legible  and maintainable.
    • 3rd Party Library Extensibility*: The VBUC  can be customized to convert any third party library to its native .NET equivalent. It ships with support for several libraries out of the box, which are detailed in the VBUC vs. VBUW document.
    • Legacy Data Access to NET*: The  VBUC  upgrades  the  legacy  data  access  models  (ADO,  RDO,  DAO,  ADOR)  to  .NET equivalents,  employing  special  transformation  rules  and  helper  classes  (for  some  specific source/target combinations). On  the other hand,  the UW generates a  target application  that still uses  those  legacy  data  access  models  to  communicate  with  the  database  via  COM  Interop wrapper calls. 
    • Custom Maps*: The Visual Basic Upgrade Companion Custom Maps extensibility, allows the user to upgrade their non-supported libraries and controls using a simple set of user-defined transformations. 
    • User declarations advanced refactoring*: The Visual Basic Upgrade Companion manages all the user declarations to perform tasks such
      as using standard Naming Conventions for the .NET languages and recognizing conflictive user-declaration names to assign new denominations (including all of its references).These tasks improve the resulting source code readability and hasten the manual change stage.
    • COM class exposure*: When this optional feature is enabled, the Visual Basic Upgrade Companion will generate attributes for the COM-exposed classes and their members, in order to keep the resulting assemblies exposed through a COM interface. This enables the resulting components to be called from other non-managed components via COM.

    Make sure you download the PDF on the  Visual Basic Upgrade Companion vs. Upgrade Wizard page for additional details. Items marked with * are ONLY available in the Visual Basic Upgrade Companion (VBUC), and are not available in the VBUC Developer Edition.

This Blog

Syndication

Powered by Community Server (Non-Commercial Edition), by Telligent Systems