esriSystem.IUID values translate incorrectly


Summary
Using the Visual Basic Upgrade Wizard in Visual Studio to auto-translate Visual Basic 6 (VB6) code to Visual Basic .NET (VB .NET) is not 100 percent automated. This topic shows ArcGIS developers how to manually correct code where VB6 esriSystem.IUID values do not work after the auto-translation.

About esriSystem.IUID values

The following are example VB .NET errors:
  • Error 1 Class 'ColorBivariateRend' must implement 'ReadOnly Property ID() As UID' for interface 'ESRI.ArcGIS.esriSystem.IPersistVariant'. Implementing property must have matching 'ReadOnly' or 'WriteOnly' specifiers.
  • Error 2 'IPersistVariant_ID' cannot implement 'ID' because there is no matching property on interface 'ESRI.ArcGIS.esriSystem.IPersistVariant'.
The following is the cause of the VB .NET error:
  • The wrong return data type is not translated correctly by the upgrade wizard for properties and functions that return an esriSystem.IUID. In VB .NET, it is esriSystem.UID. Change the return data type to the correct data type.
The following is the original VB6 code:
Private Property Get IPersistVariant_ID() As esriSystem.IUID
End Property
The following is the auto-translated code to VB .NET:
[VB.NET]
'Initial auto-translated VB .NET conversion.
Private ReadOnly Property IPersistVariant_ID() As ESRI.ArcGIS.esriSystem.IUID Implements ESRI.ArcGIS.esriSystem.IPersistVariant.ID
End Property
[VB.NET]
'Correct VB .NET translation.
Private ReadOnly Property IPersistVariant_ID() As ESRI.ArcGIS.esriSystem.UID Implements ESRI.ArcGIS.esriSystem.IPersistVariant.ID
End Property


See Also:

Migrating from VB6 to VB.NET
General steps for migrating from VB6 to VB.NET




Development licensing Deployment licensing
ArcGIS for Desktop Basic ArcGIS for Desktop Basic
ArcGIS for Desktop Standard ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced ArcGIS for Desktop Advanced
Engine Developer Kit Engine