You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
staticclassModule1{publicstaticvoidMain(){vararr=newint[6];arr[0]=0;arr[1]=1;arr[2]=2;arr[3]=3;arr[4]=4;arr[5]=5;;
#error Cannot convert LocalDeclarationStatementSyntax - see comment for details
/* Cannot convert LocalDeclarationStatementSyntax, System.InvalidCastException: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.EmptyStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax'. at System.Linq.Enumerable.<CastIterator>d__97`1.MoveNext() at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection) at ICSharpCode.CodeConverter.CSharp.MethodBodyExecutableStatementVisitor.<VisitLocalDeclarationStatement>d__31.MoveNext() --- End of stack trace from previous location where exception was thrown --- at ICSharpCode.CodeConverter.CSharp.HoistedNodeStateVisitor.<AddLocalVariablesAsync>d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at ICSharpCode.CodeConverter.CSharp.CommentConvertingMethodBodyVisitor.<DefaultVisitInnerAsync>d__3.MoveNext() Input: Dim r = From e In arr Select p = $"value: {e}" */foreach(varminr)Console.WriteLine(m);}}
Expected output
I believe the LINQ statement should be converted into something like this:
varr=fromeinarrletp=$"value: {e}"selectp;
The reason is that, in VB.NET, the Select LINQ statement with assignments seems working like let in C# with following select of the variable defined in the let statement.
Details
Product in use: VS extension
Version in use: 8.2.2.0
Did you see it working in a previous version, which? Did not test in previous versions
The text was updated successfully, but these errors were encountered:
Thanks, I hadn't seen this syntax before. The linq conversion code is more complicated than the rest of the converter, but I think this specific case could probably be added easily enough.
If anyone wants to have a go at this, as always, just run the above example under a debugger and see where it initially throws. Probably somewhere around here:
Input code
Erroneous output
Expected output
I believe the LINQ statement should be converted into something like this:
The reason is that, in VB.NET, the
Select
LINQ statement with assignments seems working likelet
in C# with followingselect
of the variable defined in thelet
statement.Details
The text was updated successfully, but these errors were encountered: