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#: comments/trivia in wrong location #1095

Open
TymurGubayev opened this issue Apr 22, 2024 · 0 comments
Open

VB -> C#: comments/trivia in wrong location #1095

TymurGubayev opened this issue Apr 22, 2024 · 0 comments
Labels
enhancement VB -> C# Specific to VB -> C# conversion

Comments

@TymurGubayev
Copy link
Contributor

TymurGubayev commented Apr 22, 2024

VB.Net input code

    'a
    Property P(i As Integer)
        'b
        Get
            '1
            Dim x = 1 '2
            '3
        End Get

        'c
        Set(value)
            '4
            Dim x = 1 '5
            '6
            x = value + i '7
            '8
        End Set
        'd
    End Property

Erroneous output

        // a
        // b
        public void get_P(int i)
        {
            // 1
            int x = 1; // 2
            return default(object);
            // 3

            // c
            // 4
            // 6
            // 8
            // d
        } // 5
          // 7

        public void set_P(int i, void value)
        {
            int x = 1;
            x = Conversions.ToInteger(Operators.AddObject(value, i));
        }

Expected output

        // a
        public void get_P(int i)
        // b
        {
            // 1
            int x = 1; // 2
            return default(object);
            // 3
        }
        
        // c
        public void set_P(int i, void value)
        {
            // 4
            int x = 1; // 5
            // 6
            x = Conversions.ToInteger(Operators.AddObject(value, i)); // 7
            // 8
        }
        // d

This only affects trivia, so the code isn't actually broken, and as far as I can tell no comment is lost, but there is loss of information nonetheless: it's impossible to map the comments to the statements they belong to.

Details

  • Product in use: VS extension
  • Version in use: 5143c08
  • Did you see it working in a previous version, which? no

Related issues coalesced

#1098

@TymurGubayev TymurGubayev added the VB -> C# Specific to VB -> C# conversion label Apr 22, 2024
@GrahamTheCoder GrahamTheCoder changed the title VB -> C#: trivia from parameterized property setter is moved to the getter VB -> C#: comments/trivia in wrong location Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement VB -> C# Specific to VB -> C# conversion
Projects
None yet
Development

No branches or pull requests

2 participants