Skip to content

VB -> C#: Action lambda breaks #783

Closed

Description

@docfresh

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);

Activity

  1. added
    VB -> C#
    on Nov 4, 2021
  2. GrahamTheCoder commented on Dec 11, 2021

    @GrahamTheCoder
    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

  3. added
    compilation error
    on Dec 30, 2021
  4. added a commit that references this issue on Nov 24, 2026
    5f6a7b3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    VB -> C#compilation error

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions