-
Notifications
You must be signed in to change notification settings - Fork 227
Closed
Labels
VB -> C#Specific to VB -> C# conversionSpecific to VB -> C# conversionoutput logic errorA bug where the converted output behaves differently to the input codeA bug where the converted output behaves differently to the input code
Description
VB.Net input code
Private Shared Sub DefaultInitialization()
For i = 1 To 2
Dim b As Boolean
If i = 1 Then
Assert.That(Not b)
Else
Assert.That(b)
End If
b = True
Assert.That(b)
Next
End SubErroneous output
private static void DefaultInitialization()
{
for (int i = 1; i <= 2; i++)
{
var b = default(bool);
if (i == 1)
{
Assert.That(!b);
}
else
{
Assert.That(b);
}
b = true;
Assert.That(b);
}
}Expected output
private static void DefaultInitialization()
{
var b = default(bool); // define and initialize outside loop or do not initialize (with compile error CS0165)
for (int i = 1; i <= 2; i++)
{
// bool b;
if (i == 1)
{
Assert.That(!b);
}
else
{
Assert.That(b);
}
b = true;
Assert.That(b);
}
}Details
- Product in use: VS extension
- Version in use: 9.0.0.0
- Did you see it working in a previous version, which? no
Metadata
Metadata
Assignees
Labels
VB -> C#Specific to VB -> C# conversionSpecific to VB -> C# conversionoutput logic errorA bug where the converted output behaves differently to the input codeA bug where the converted output behaves differently to the input code