Notes

The following are some of the most common Notes generated by the VB6 AI Migrator.

1707 - The resulting shared file would differ depending on whether all or some projects are migrated.

Description

This EWI appears in shared files between two or more projects. In VB6 AI Migrator, you can upgrade the projects using one of the following options:

  1. Upgrade Projects: Clicking this button will upgrade the entire solution.

  2. Upgrade Selection: Select specific projects to upgrade and click this button to upgrade only those selected projects.

The main difference between the two options lies in the scope of migration. The Upgrade Projects option migrates the entire solution, preserving the context and settings of all projects. In contrast, Upgrade Selection upgrades only the selected projects, which may result in significant variations in the shared files, as they are upgraded based on the context of just those chosen projects.

Recommendation: We recommend always using the Upgrade Projects option to ensure a consistent and complete migration. However, if you choose the Upgrade Selection option, we strongly recommend identifying the projects that contain shared files beforehand. Once you have located these projects, select them and click the Upgrade Selection button to upgrade them properly.

For more information on how to identify projects with shared files, visit Upgrade Projects with shared files

2041 - The following line was commented

Description

This EWI appears if for some reason the line can cause compilation errors and therefore the migration tool decides to comment it out.

API Calls are Moved

The VB6 AI Migrator performs some code refactoring on any of the API calls that it finds by consolidating all those calls into new files. When this happens, the original VB6 Declare API statement is commented out. This line is just left as an information reference. The recommendation is to remove this line.

See also: API Call Conversion to Platform Invoke

VB6 Original Code

C# Upgraded Code

VB.NET Upgraded Code

6016 - Structure %1 should be within the shared file due to its use in Declare statement for a Windows API

Description

When migrating a solution made up of several projects, the use of shared files is common; in case a type is presented in that file, and one project uses this type as part of a native call (Windows API), and another project it is not; that type will exist in both, the PInvoke project and the shared file.

API Calls and structures are moved

The VB6 AI Migrator performs a refactoring of the API calls it encounters, along with types that can be used as parameters to those calls in new files. When that happens, the original VB6 Declare API statement is commented out. However, if there is another project that uses the same structure with no native calls in it, it must be kept in the code.

See also: API Call Conversion to Platform Invoke

VB6 Original Code

Common/Module1.bas

Project1/MainForm.frm

Project2/dlls.bas

C# Upgraded Code

Common/Module1.cs

Project1/MainForm.cs

Project2/dlls.cs

UpgradeSolution1Support/PInvoke/UnsafeMethods/Structures.cs

C# Expected Code

The C# code contains two structs, one inside the shared file, the other one inside the PInvoke project. To maintain proper use of types, the type inside of the shared file can be removed or commented; and the uses of this type can be changed to the type inside the PInvoke project.

Common/Module1.cs

Project1/MainForm.cs

Project2/dlls.cs

UpgradeSolution1Support/PInvoke/UnsafeMethods/Structures.cs

VB.NET Upgraded Code

Common/Module1.vb

Project1/MainForm.vb

Project2/dlls.vb

UpgradeSolution1Support/PInvoke/UnsafeMethods/Structures.vb

VB.NET Expected Code

The VB.NET code contains two structs, one inside the shared file, the other one inside the PInvoke project. To maintain proper use of types, the type inside of the shared file can be removed or commented; and the uses of this type can be changed to the type inside the PInvoke project.

Common/Module1.vb

Project1/MainForm.vb

Project2/dlls.vb

UpgradeSolution1Support/PInvoke/UnsafeMethods/Structures.vb

6017 - Inaccessible enum value %1 was changed to its numerical value %2

Description

Since native declarations are moved to a separate support project, enums used as default values for optional parameters may not be accessible, and attempting to reference them could generate a circular reference.

To fix this issue, the enum element is replaced by its numerical value.

VB6 Original Code

C# Upgraded Code

VB.NET Upgraded Code

7001 - The following %1 (%2) seems to be dead code

Description

The VB6 AI Migrator analyzes the private subroutines and functions of each source code file, identifies the ones which are not used, and generates them commented out with this EWI preceding them. This improves the migration process by reducing the amount of manual work required to compile the application in .NET.

Recommendations

The target methods can be removed from the upgraded source code if they will not be used in the future. The code for these methods is upgraded but commented out. It is necessary to keep this code, it can be uncommented and used with the rest of the application.

circle-info

This EWI is associated with the upgrade option Comment Out Dead Code. If it is turned off, unused code will not be commented on.

VB6 Original Code

C# Upgraded Code

VB.NET Upgraded Code

8001 - Element %1 was removed

Description

This message is displayed for several maps, when an element used in VB6 is obsolete in .NET or it is just no longer needed. This EWI is displayed if an assignment to a Property that will not be supported on the target is found because the target element is no longer available or the whole statement is commented out.

VB6 Original Code

C# Upgraded Code

VB.NET Upgraded Code

8008 - Element %1 is obsolete and should be removed

Description

In this scenario, the element is no longer available on the target platform. However, it is part of a function call or expression and the statement cannot be removed without user revision. Therefore this note is issued so the user can take proper action.

circle-info

This line will cause a compilation issue and must be corrected.

VB6 Original Code

C# Upgraded Code

VB.NET Upgraded Code

Last updated

Was this helpful?