-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
VB -> C#: Cannot convert ForEachBlockSyntax #601
Comments
Thanks for the report. There isn't quite enough context for me to immediately reproduce the issue. |
Here you go -- the class file with its members, a constructor, and the offending function. I could reproduce the bug by adding this file to a WinForms VB.NET project, and attempting a convert. I suspect its because of the way the foreach types are declared as form members, but I'm not sure. |
Here is a VB project ready to convert / throw the bug. |
Thanks! |
I reproduced a similar looking error. Using a class member as the foreach variable should be supported in the next release. |
Ran into this after conversion.
Input code
Erroneous output
#error Cannot convert ForEachBlockSyntax - see comment for details
/* Cannot convert ForEachBlockSyntax, System.InvalidCastException: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.MemberAccessExpressionSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.IdentifierNameSyntax'.
at ICSharpCode.CodeConverter.CSharp.MethodBodyExecutableStatementVisitor.d__61.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at ICSharpCode.CodeConverter.CSharp.HoistedNodeStateVisitor.d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at ICSharpCode.CodeConverter.CSharp.CommentConvertingMethodBodyVisitor.d__3.MoveNext()
Details
The text was updated successfully, but these errors were encountered: