WARNING #1063

    Arrays in structure %1 may need to be initialized before they can be used.

    Description

    In Visual Basic .NET, fixed-size arrays in structures are not supported. Fixed-size arrays that are members of structures defined in COM interfaces will need to be initialized before they can be used.

    Recommendations

    Call function Initialize of the structure, just after the variable declaration.

    For example Structure2 will be defined as:

    private struct Structure2
    {
      public int Size;
      public int[] Numbers;
      public void Initialize()
      {
        Numbers = new int[]{};
      }
    }

    Sample VB6

    Private Type Structure2
        Size As Integer
        Numbers() As String
    End Type
    Private Type Structure1
       name As String
       str2 As Structure2
    End Type

    Target VB.NET

    Private Structure Structure2
       Dim Size As Integer
       Dim Numbers() As String
    End Structure
    Private Structure Structure1
       Dim name As String
       'UPGRADE_WARNING: (1063) Arrays in structure str2 may need to be initialized before they can be used.
       Dim str2 As Structure2
    End Structure

    Target C#

    private struct Structure2
    {
       public int Size;
       public int[] Numbers;
    }
    private struct Structure1
    {
       public string name;
       //UPGRADE_WARNING: (1063) Arrays in structure str2 may need to be initialized before they can be used.
       public Structure2 str2;
    }


    Download VBUC Free Trial
    Download VBUC Now

    It's time to eradicate VB6
    ROI of eradicating VB6

    8 Proven Tips for
    Planning a Successful Migration

    8 Tips for migration