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#: wrong conversion of shared property containing static variable #881

Closed
KunzeAndreas opened this issue Apr 24, 2022 · 0 comments · Fixed by #884
Closed

VB -> C#: wrong conversion of shared property containing static variable #881

KunzeAndreas opened this issue Apr 24, 2022 · 0 comments · Fixed by #884
Assignees
Labels
compilation error A bug where the converted output won't compile VB -> C# Specific to VB -> C# conversion

Comments

@KunzeAndreas
Copy link

KunzeAndreas commented Apr 24, 2022

VB.Net input code

Private Shared ReadOnly Property StaticTestProperty() As Integer
     Get
         Static variable As Integer = 1

          Debug.Print(variable.ToString)

           variable += 1

           Return variable
       End Get
End Property

Erroneous output

private int _StaticTestProperty_variable = 1;

private static int StaticTestProperty
{
    get
    {
        Debug.Print(_StaticTestProperty_variable.ToString());
        _StaticTestProperty_variable += 1;
        return _StaticTestProperty_variable;
    }
}

static modifier is missing. Conversion of function containing shared variable works.

Expected output

  private static int _StaticTestProperty_variable = 1;

  private static int StaticTestProperty
  {
      get
      {
          Debug.Print(_StaticTestProperty_variable.ToString());
          _StaticTestProperty_variable += 1;
          return _StaticTestProperty_variable;
      }
  }

Details

  • Product in use: VS extension
  • Version in use: 8.5.0.0
  • Did you see it working in a previous version, which? no
@KunzeAndreas KunzeAndreas added the VB -> C# Specific to VB -> C# conversion label Apr 24, 2022
@KunzeAndreas KunzeAndreas changed the title VB -> C#: wrong conversion of property containing static variable VB -> C#: wrong conversion of shared property containing static variable Apr 24, 2022
@Yozer Yozer added the compilation error A bug where the converted output won't compile label Apr 26, 2022
@Yozer Yozer self-assigned this Apr 26, 2022
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

Successfully merging a pull request may close this issue.

2 participants