Skip to content

Breaking change and possible Bug in SyntaxFactory.ParseCompilationUnit with the new GlobalStatementSyntax #48512

Answered by CyrusNajmabadi
Herrmel asked this question in Q&A
Discussion options

You must be logged in to vote

This is by design (for a few reasons). First, we do not absolutely guarantee parsing output from version to version. Some construccts will change parsing depending on the versions you're using. For example, record Foo(int i) { } would previously parse as a method/function. Now it will parse as a record. On top of this, we absolutely will change parsing around constructs that were previously not legal and now are legal. In your case you have:

#region SetValue

        private void SetValue(double value)
        {
//whatever
        }

#endregion SetValue

this was never legal code in the past. So the parser just did its best and just produced some concrete syntax tree encoding that (using …

Replies: 5 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by Herrmel
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@CyrusNajmabadi
Comment options

@CyrusNajmabadi
Comment options

@Herrmel
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #48512 on October 12, 2020 15:18.