Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VB -> C#: Overloads Overrides Property #681

Closed
marcal opened this issue Nov 13, 2020 · 1 comment
Closed

VB -> C#: Overloads Overrides Property #681

marcal opened this issue Nov 13, 2020 · 1 comment
Labels
VB -> C# Specific to VB -> C# conversion

Comments

@marcal
Copy link

marcal commented Nov 13, 2020

Hello,

I have seen a problem with a conversion of a control (that inherits Datagridview)

Input code

Public Overloads Overrides Property CellTemplate() As DataGridViewCell
        Get
            Return MyBase.CellTemplate
        End Get
        Set(ByVal value As DataGridViewCell)
            If (value Is Nothing) OrElse Not (TypeOf value Is ImageColorCell) Then
                Throw New ArgumentException("Invalid cell type, StatusColumns can only contain StatusCells")
            End If
        End Set
    End Property

Erroneous output

public new override DataGridViewCell CellTemplate
        {
            get
            {
                return base.CellTemplate;
            }

            set
            {
                if (value is null || !(value is ImageColorCell))
                {
                    throw new ArgumentException("Invalid cell type, StatusColumns can only contain StatusCells");
                }
            }
        }

Expected output

I have no idea (I don't know C#enough). Without override it works but I have no idea if it is correct

Details

Last version of the .NET plugin. I have never tested before so I have no idea if it is a new problem or not.

Thank you
Marc

@marcal marcal added the VB -> C# Specific to VB -> C# conversion label Nov 13, 2020
@GrahamTheCoder
Copy link
Member

Thanks for the report! There was a similar more general problem previously that I fixed (#463). Looks like this Overloads Overrides case wasn't covered. Hopefully it's easy to build on the fix linked from that issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VB -> C# Specific to VB -> C# conversion
Projects
None yet
Development

No branches or pull requests

2 participants