VB.Net input code
Public Class ConversionTest3
Private Class MyEntity
Property EntityId As Integer
Property Name As String
End Class
Private Sub BugRepro()
Dim entities As New List(Of MyEntity)
Parallel.For(1, 3, Sub(i As Integer)
Dim result As String = (From e In entities
Where e.EntityId = 123
Select e.Name).Single
End Sub)
End Sub
End Class
Erroneous output
This appears to do something with null checking (which wasn't in the VB code), and it puts all the LINQ code on a single line (due to the Parallel loop).
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
namespace abc
{
public class ConversionTest3
{
private class MyEntity
{
public int EntityId { get; set; }
public string Name { get; set; }
}
private void BugRepro()
{
var entities = new List<MyEntity>();
Parallel.For(1, 3, (i) => { string result = (from e in entities where e.EntityId == 123 select e.Name).Single(); });
}
}
}
Expected output
private void BugRepro()
{
var entities = new List<MyEntity>();
Parallel.For(1, 3, (i) => {
string result = (from e in entities
where e.EntityId == 123
select e.Name).Single();
});
}
Details
- Product in use: VS extension
- Version in use: 9.2.2.0
- When the Parallel loop contains only a single command of code, like my LINQ query above, conversion puts everything on a single line. If the Parallel loop contains more than one command inside, conversion keeps them on separate lines as expected.
- This is a simplified repro code
VB.Net input code
Erroneous output
This appears to do something with null checking (which wasn't in the VB code), and it puts all the LINQ code on a single line (due to the Parallel loop).
Expected output
Details