CodeConverter
CodeConverter copied to clipboard
VB -> C#: Converting Parallel loop moves all comments outside of loop
Possibly related to Issue #1012
VB.Net input code
Public Class ConversionTest1
Public Sub BugRepro()
Dim dt As New DataTable
Parallel.ForEach(dt.AsEnumerable(), Nothing, Sub(row As DataRow)
If Not String.IsNullOrWhiteSpace("") Then
'comment1
Dim test1 As Boolean = True
'comment2
Dim test2 As Boolean = True
'comment3
Dim test3 As Boolean = True
End If
End Sub)
End Sub
End Class
Erroneous output
public class ConversionTest1
{
public void BugRepro()
{
var dt = new DataTable();
// comment1
// comment2
// comment3
Parallel.ForEach(dt.AsEnumerable(), null, (row) => { if (!string.IsNullOrWhiteSpace("")) { bool test1 = true; bool test2 = true; bool test3 = true; } });
}
}
Expected output
The comments should be inside the Parallel statement with the code they belong to
### Details
* Product in use: VS extension
* Version in use: 9.2.2.0