BUG: “Public Overrides WriteOnly Property…” error when you try to override a Microsoft Visual Basic 6.0 property in Microsoft Visual Basic .NET
Symptoms
You have a Microsoft Visual Basic 6.0 class that has a property with the ByRef parameter. When you inherit the class in Visual Basic .NET and override the property, you receive the following compilation error:
‘Public Overrides WriteOnly Property myProp() As System.IntPtr’ cannot override ‘Public Overridable Overloads WriteOnly Property myProp() As System.IntPtr’ because they differ by their return types.
Resolution
The .NET runtime compares the return types of the parameters in the base class and inherited class property. This comparison returns a difference in the return types while it compares the symbols for System.IntPtr and System.Int16. Two separate symbols represent these internally. This results in an error.

Leave a Reply