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#: Ref instead of Out parameter is generated for implementations of external methods #831

Closed
Yozer opened this issue Feb 12, 2022 · 0 comments · Fixed by #832
Closed
Labels
VB -> C# Specific to VB -> C# conversion

Comments

@Yozer
Copy link
Member

Yozer commented Feb 12, 2022

VB.Net input code

Class TestClass
    Implements IReadOnlyDictionary(Of Integer, Integer)
    Public Function TryGetValue(key as Integer, ByRef value As Integer) As Boolean Implements IReadOnlyDictionary(Of Integer, Integer).TryGetValue
        value = key
    End Function

    Private Sub TestMethod()
        Dim value As Integer
        Me.TryGetValue(5, value)
    End Sub
End Class

Erroneous output

class TestClass : IReadOnlyDictionary<int, int>
{
    public bool TryGetValue(int key, ref int value)
    {
        value = key;
        return default;
    }

    private void TestMethod()
    {
        var value = default(int);
        TryGetValue(5, ref value);
    }
}

Expected output

internal partial class TestClass : IReadOnlyDictionary<int, int>
{
    public bool TryGetValue(int key, out int value)
    {
        value = key;
        return default;
    }

    private void TestMethod()
    {
        var value = default(int);
        TryGetValue(5, out value);
    }
}

Details

  • Product in use: e.g. VS extension
  • Version in use: e.g. 5.6.3 or a commit hash ac30790
  • Did you see it working in a previous version, which?
  • Any other relevant information to the issue, or your interest in contributing a fix.
@Yozer Yozer added the VB -> C# Specific to VB -> C# conversion label Feb 12, 2022
@Yozer Yozer mentioned this issue Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VB -> C# Specific to VB -> C# conversion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant