Skip to content

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

Closed
@KunzeAndreas

Description

@KunzeAndreas

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

Metadata

Metadata

Assignees

Labels

VB -> C#Specific to VB -> C# conversioncompilation errorA bug where the converted output won't compile

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions