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#: Action lambda breaks #783

Open
docfresh opened this issue Nov 4, 2021 · 1 comment
Open

VB -> C#: Action lambda breaks #783

docfresh opened this issue Nov 4, 2021 · 1 comment
Labels
compilation error A bug where the converted output won't compile VB -> C# Specific to VB -> C# conversion

Comments

@docfresh
Copy link

docfresh commented Nov 4, 2021

Error thrown by compiler on erroreous code is "Delegate Action does not take 0 arguments" (CS1593)

VB.Net input code

    Private Sub btnFilter_Click(sender As Object, e As EventArgs) Handles btnFilter.Click
        upMCIF.Height = Me.Height - Me.Panel1.Height - 20
        upMCIF.Width = Me.Width - 20


        upMCIF.ShowPopup(8, Me.Panel1.Height, Sub()
                                                  'upMCIF.Height = 1
                                                  'upMCIF.Width = 1
                                                  Me.SetFilters()
                                                  Me.Focus()
                                                  btnFilter.Refresh()
                                                  btnFilter.Invalidate()
                                                  btnFilter.Update()

                                              End Sub)
        upMCIF.Focus()
    End Sub

Erroneous output

private void btnFilter_Click(object sender, EventArgs e)
        {
            upMCIF.Height = Height - Panel1.Height - 20;
            upMCIF.Width = Width - 20;
            upMCIF.ShowPopup(8, Panel1.Height, () =>
            {
                // upMCIF.Height = 1
                // upMCIF.Width = 1
                SetFilters();
                Focus();
                btnFilter.Refresh();
                btnFilter.Invalidate();
                btnFilter.Update();
            });
            upMCIF.Focus();
        }

Expected output

//Unsure of what the right code should be, but this would compile.

private void btnFilter_Click(object sender, EventArgs e)
        {
            upMCIF.Height = Height - Panel1.Height - 20;
            upMCIF.Width = Width - 20;

            upMCIF.ShowPopup(8, Panel1.Height, (onclose) =>
            {
                // upMCIF.Height = 1
                // upMCIF.Width = 1
                SetFilters();
                Focus();
                btnFilter.Refresh();
                btnFilter.Invalidate();
                btnFilter.Update();
            });

            upMCIF.Focus();
        }

Details

CC 8.41 vs2019 extension

Signature of ShowPopup is

    public void ShowPopup(int x, int y, Action<UserPopup> onclose = null);
@docfresh docfresh added the VB -> C# Specific to VB -> C# conversion label Nov 4, 2021
@GrahamTheCoder
Copy link
Member

Thanks, I'm pretty sure the converter has some code to deal with this case already, will have to investigate why it's not working in this case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compilation error A bug where the converted output won't compile VB -> C# Specific to VB -> C# conversion
Projects
None yet
Development

No branches or pull requests

2 participants