VB -> C#: OnErrorGoToStatementSyntax and OnErrorResumeNextStatementSyntax
See original GitHub issueOnErrorGoToStatementSyntax
,OnErrorResumeNextStatementSyntax
- Many cases can probably be reasonably successfully converted as
try...catch
and then a goto within the catch and an appropriately placed label
- Many cases can probably be reasonably successfully converted as
Resume Next Example
int lineNumber = 1;
try
{
line1: lineNumber++;
//First line of code would be here
line2: lineNumber++;
//Second line of code would be here
}
catch
{
switch(lineNumber)
{
case 1: goto line1;
case 2: goto line2;
}
}
Note: Even this messy solution isn’t valid because line1 is out of scope of the catch block and could be in a nested scope even within the try block
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (5 by maintainers)
Top Results From Across the Web
VisualBasicSyntaxWalker Class
Represents a VisualBasicSyntaxVisitor that descends an entire SyntaxNode tree visiting each SyntaxNode and its child SyntaxNodes and SyntaxTokens in ...
Read more >SyntaxKind.vb
''' Represents an OnError Resume Next statement. ''' </summary>; OnErrorResumeNextStatement = 199 ' OnErrorResumeNextStatementSyntax ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I found this issue as well, my project has a lot of "On Error GoTo"s and I’d be grateful if someone implemented this syntax
One idea for implementing exactly the resume next logic: