Having Problems with the Visual Basic 6 Code Advisor?

The Code Advisor is an add-in for the VB6 IDE that analyzes VB6 source and identifies code areas where changes are necessary for migrating to VB.NET. The utility is extremely handy and works very well in conjunction with the Upgrade Wizard that ships with VS.NET. Theoretically, if you run your VB6 project through the code advisor and make all of the recommended changes, the upgrade wizard for VS.NET should upgrade your VB6 project to VB.NET without any problems

Microsoft offers “best effort“ support for the code advisor. Don't bother searching the knowledge base as there are currently no KB articles that discuss any issues with the code advisor and there have been very few support incidents that even mention the tool. Google’ing also yields no results. There are some known issues listed on the code advisor web site.

The two known issues are both related to install/uninstall and are:

 

Setup fails with Unicode characters in the installation path on non-English operating systems.

During setup, specifying an installation path that contains certain Unicode characters can cause the setup to fail. To fix this problem, either accept the default installation path or enter an installation path that does not contain Unicode characters.

 

Uninstall fails to remove registry keys.

When the Code Advisor is uninstalled, registry keys for the FixIt Filter settings are not removed. If you subsequently reinstall the Code Advisor, your previous FixIt Filter settings will be restored instead of reverting to the default settings. To revert to the default settings, open Regedit.exe and delete the following keys before re-installing:

HKEY_USERS\{…}\Software\VB and VBA Program Settings\Code Advisor for Visual Basic 6\1\
HKEY_USERS\{…}\Software\VB and VBA Program Settings\Code Advisor for Visual Basic 6\2\
HKEY_USERS\{…}\Software\VB and VBA Program Settings\Code Advisor for Visual Basic 6\3\
HKEY_USERS\{…}\Software\VB and VBA Program Settings\Code Advisor for Visual Basic 6\State\

Where {…} is a unique identifier for each user.

 

The code advisor creates an error log in the %TEMP% folder on your system called CodeAdvisorError.log. This file is your best bet in resolving any issues that crop up while using the code advisor. Entries to the log are appended to the end, the file is not overwritten so be mindful of the entry dates. One particular error message you might see (and yes you guessed it, I had a customer that ran into this the other day):

 

 

"Erros were encountered while attempting to remove and then add 'FixIt' source code comments."

The error log would look something like this:

2/16/2004 3:45:36 PM 424 FixItAddin.FixItController.UpdateControllerStatus.Connect.evtProjectsEvents_ItemAdded Object required 1000424

2/16/2004 4:32:28 PM 9 FixItAddin.Utilities.ScanWithLineUtilities.ExtendMatchCollectionEx.Utilities.ExecuteRegExp.FixItLocateUsage.IRuleHandler_Evaluate..Rule.Evaluate.FixItController.AddFixIts Err.Description: Subscript out of range---Rule: Soft Binding of Form or Control--Component: frmPaymentProcessCCEdit 1000009

2/16/2004 5:36:10 PM 521 FixItAddin.Connect.ClipboardContents.Connect.AddinInstance.OnConnection Can't open Clipboard 1000521

2/17/2004 11:48:33 AM 9 FixItAddin.Utilities.ScanWithLineUtilities.ExtendMatchCollectionEx.Utilities.ExecuteRegExp.FixItLocateUsage.IRuleHandler_Evaluate..Rule.Evaluate.FixItController.AddFixIts Err.Description: Subscript out of range---Rule: Soft Binding of Form or Control--Component: frmPaymentProcessCCEdit 1000009

2/18/2004 11:19:58 AM 424 FixItAddin.FixItController.UpdateControllerStatus.Connect.evtProjectsEvents_ItemAdded Object required 1000424

2/20/2004 6:12:19 PM 9 FixItAddin.Utilities.ScanWithLineUtilities.ExtendMatchCollectionEx.Utilities.ExecuteRegExp.FixItLocateUsage.IRuleHandler_Evaluate..Rule.Evaluate.FixItController.AddFixIts Err.Description: Subscript out of range---Rule: Soft Binding of Form or Control--Component: frmPaymentProcessCCEdit 1000009

All the code advisor does is to build a source code tree of the project you’re running it against (this makes sense if you are familiar with compilers, if not read: Generating Source Code and Comiling a Program from a CodeDOM Graph – yes, a MS plug…if you want something more general, google “parse tree” AND compiler). So, the potential for failures exists at four different locations:

  1. Loading of the add-in within the development environment / execution

  2. Parsing of the source code (creating the parse tree)

  3. Applying the source code rules

  4. Modifying of the VB source code files

For the particular error message above the problem was related to the corruption of the parse tree. This is easily identifiable because the errors in the log file above are all for the same project yet the errors seem to be random and unrelated. To resolve the issue, all you have to do is remove the form that’s causing the problem from the project. In some cases you may have to remove multiple forms (you can either remove all files that are references in the error log or cycle through them one at a time till you find the problem form…depends on how patient you are! ;) ).

To troubleshoot the other errors you can use FileMon and RegMon (https://www.sysinternals.com) to identify problems writing to files or accessing the registry. You can also try booting your XP machine into diagnostic mode (msconfig.exe) and seeing if any external app is playing games with the code advisor.

 

If nothing else, call us…