BYTEINSIGHT
GAPVelocity AI Studio helps you move from outdated tech stacks to the latest desktop, web, and cloud platforms—smarter, faster, and with less risk.
Choose a platform to see migration options:
Our comprehensive approach to application modernization, from assessment to production deployment.
Transformation Services
Not Sure Where to Start?
This EWI appears if for some reason the line can cause compilation errors and therefore the migration tool decides to commented out.
This can have due to several reasons, for example:
In C# a foreach variable can't be assignable, so to avoid a compilation error, the line must be commented. In VB.Net the iteration variable can be assigned so, this restriction is not applied.
Check the logic of the original VB6 function. In some cases the nothing assignation to the iteration variable is a way to stop the cycle. If this is the case use the break statement instead.
For the given example, just remove the commented line and the EWI.
Public Function TestCommentedLines(ByVal P() As String) As Integer
Dim S
Dim Count As Integer
For Each S In P
If Not S IsNothing Then
MsgBox(S)
Count = Count + 1
S = Nothing
End If
Next S
TestCommentedLines = Count
End Function
Public Function TestCommentedLines(ByRef P() AsString) As Integer
Dim Count As Integer
Dim S As String
ForEach S As String In P
If Not (S IsNothing) Then
MessageBox.Show(S, Application.ProductName)
Count += 1
S = Nothing
End If
Next S
Return Count
End Function
This Issue doesn't appear on VB.NET Code.
public int TestCommentedLines( string[] P)
{
int Count = 0;
foreach (string S in P)
{
if (S != null)
{
MessageBox.Show(S, Application.ProductName);
Count++;
//UPGRADE_NOTE: (2041) The following line was commented.
//S = null;
}
}
return Count;
}
public int TestCommentedLines( string[] P)
{
int Count = 0;
foreach (string S in P)
{
if (S != null)
{
MessageBox.Show(S, Application.ProductName);
Count++;
}
}
return Count;
}
The VB6 AI Migrator performs some code refactoring on any of the API calls that it finds. Consolidating all those calls into new files. When that happened 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.
For more information see API Call conversion to Platform Invoke