-
Notifications
You must be signed in to change notification settings - Fork 225
Description
VB.Net input code
Dim fields = (From v In _DisplayFields Select Value = v, Name = [Enum].GetName(GetType(Field), v) Order By Value Ascending).ToArray
note that the following works fine, which is functionally identical:
Dim fields = _DisplayFields.Select(Function(v) New With {.Value = v, .Name = [Enum].GetName(GetType(Field), v)}).OrderBy(Function(x) x.Value).ToArray
Erroneous output
var fields = default
#error Cannot convert QueryExpressionSyntax - see comment for details
/* Cannot convert QueryExpressionSyntax, System.InvalidOperationException: Sequence contains more than one element
at System.Linq.Enumerable.Single[TSource](IEnumerable1 source) at ICSharpCode.CodeConverter.CSharp.QueryConverter.<ConvertSelectClauseAsync>d__34.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at ICSharpCode.CodeConverter.Common.EnumerableExtensions.<YieldAsync>d__6
1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at ICSharpCode.CodeConverter.CSharp.QueryConverter.d__27.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at ICSharpCode.CodeConverter.CSharp.QueryConverter.d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at ICSharpCode.CodeConverter.CSharp.QueryConverter.d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at ICSharpCode.CodeConverter.CSharp.QueryConverter.d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at ICSharpCode.CodeConverter.CSharp.ExpressionNodeVisitor.d__68.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at ICSharpCode.CodeConverter.CSharp.CommentConvertingVisitorWrapper.d__12`1.MoveNext()
Input:
From v In _DisplayFields Select Value = v, Name = [Enum].GetName(GetType(Field), v) Order By Value Ascending
*/
.ToArray();
Expected output
var fields = (from v in _DisplayFields select new {Value = v, Name = Enum.GetName(typeof(Field), v)} orderby Value).ToArray();
Details
VS extension 9.2.7.0