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#: ByRef temporary variable is assigned back into a constant #1106

Closed
TymurGubayev opened this issue May 28, 2024 · 1 comment
Closed
Labels
VB -> C# Specific to VB -> C# conversion

Comments

@TymurGubayev
Copy link
Contributor

VB.Net input code

Public Class ByRefConstArgument
    Public Const i As Integer = 0

    Public Sub M(ByRef o As Object)
        M(i)
    End Sub
End Class

Erroneous output

public class ByRefConstArgument
{
    public const int i = 0;

    public void M(ref object o)
    {
        object argo = i;
        M(ref argo);
        ByRefConstArgument.i = Conversions.ToInteger(argo); // can't do this
    }
}

Expected output

public class ByRefConstArgument
{
    public const int i = 0;

    public void M(ref object o)
    {
        object argo = i;
        M(ref argo);
    }
}

Details

  • Product in use: VS extension
  • Version in use: 95cec96
  • Did you see it working in a previous version, which? No
  • Any other relevant information to the issue, or your interest in contributing a fix.
@TymurGubayev TymurGubayev added the VB -> C# Specific to VB -> C# conversion label May 28, 2024
@TymurGubayev
Copy link
Contributor Author

fixed in #1120

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

No branches or pull requests

1 participant