Repository navigation
Labels
Good for coding agentCoding agent might get it in one - small change with reproVB -> C#Specific to VB -> C# conversionoutput logic errorA bug where the converted output behaves differently to the input code
Description
VB.Net input code
Private Shared Sub ReturnWithOutParam()
Dim testclass = New OutParamTestClass
Assert.That(testclass.Number = 2)
Dim dummy = CallSubWithOutParam(testclass)
Assert.That(testclass.Number = 1)
End Sub
Private Shared Function CallSubWithOutParam(testClass As OutParamTestClass) As Boolean
Return SubWithOutParam(testClass.Number)
End Function
Private Shared Function SubWithOutParam(<Out> ByRef out_a As Integer) As Boolean
out_a = 1
Return True
End Function
Private Class OutParamTestClass
Friend Property Number As Integer = 2
End ClassErroneous output
private static void ReturnWithOutParam()
{
var testclass = new OutParamTestClass();
Assert.That(testclass.Number == 2);
bool dummy = CallSubWithOutParam(testclass);
Assert.That(testclass.Number == 1);
}
private static bool CallSubWithOutParam(OutParamTestClass testClass)
{
int argout_a = testClass.Number;
return SubWithOutParam(out argout_a);
testClass.Number = argout_a;
}
private static bool SubWithOutParam(out int out_a)
{
out_a = 1;
return true;
}
private class OutParamTestClass
{
internal int Number { get; set; } = 2;
}Expected output
private static bool CallSubWithOutParam(OutParamTestClass testClass)
{
int argout_a = testClass.Number;
var result= SubWithOutParam(out argout_a);
testClass.Number = argout_a;
return result;
}Details
- Product in use: VS extension
- Version in use: 9.0.0.0
- Did you see it working in a previous version, which? no
Reacted by Graham
Metadata
Metadata
Assignees
Labels
Good for coding agentCoding agent might get it in one - small change with reproVB -> C#Specific to VB -> C# conversionoutput logic errorA bug where the converted output behaves differently to the input code
Activity
Write back ByRef arguments before return, throw and yield (icsharpcod…