Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Information Loss" caused by use of default in SyntaxNode-Update methods #51997

Closed
bernd5 opened this issue Mar 19, 2021 · 3 comments
Closed
Labels
Area-Compilers Bug good first issue The issue is reserved for a first time, non-Microsoft contributor help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Milestone

Comments

@bernd5
Copy link
Contributor

bernd5 commented Mar 19, 2021

Version Used: 16.10.0 Preview 1.0

Steps to Reproduce:

  1. call of LocalDeclarationStatementSyntax.Update-Method

Expected Behavior:
No loose of "UsingKeyword".

Actual Behavior:
UsingKeyword is set to null

See the following discussion:
#51986

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 19, 2021
@RikkiGibson
Copy link
Contributor

The issue is specifically that default is passed as an argument in Update methods:

public LocalDeclarationStatementSyntax Update(SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
=> Update(awaitKeyword: default, usingKeyword: default, modifiers, declaration, semicolonToken);

@bernd5
Copy link
Contributor Author

bernd5 commented Mar 19, 2021

Thanks for point that out.
Most Update methods are generated but there are some nodes which have additional custom Update methods.
In my eyes the usage of default should be avoided even if the node does not really support the property (e.g. attributes which are introduced because of the inheritance hierarchy).

One additional sample is: CheckedStatementSyntax (there it is not so critical because it does not support attributes)
But for example at: ForEachStatementSyntax it is a bug.

@RikkiGibson RikkiGibson added Bug help wanted The issue is "up for grabs" - add a comment if you are interested in working on it good first issue The issue is reserved for a first time, non-Microsoft contributor labels Mar 19, 2021
bernd5 pushed a commit to bernd5/roslyn that referenced this issue Mar 21, 2021
@jaredpar jaredpar removed the untriaged Issues and PRs which have not yet been triaged by a lead label Mar 22, 2021
@jaredpar jaredpar added this to the 16.10 milestone Mar 22, 2021
@bernd5
Copy link
Contributor Author

bernd5 commented Mar 22, 2021

see: PR

@bernd5 bernd5 closed this as completed Mar 22, 2021
RikkiGibson pushed a commit that referenced this issue Mar 22, 2021
…date methods #51997 (#52036)

Co-authored-by: Bernd Baumanns <familiebaumanns@googlemail.com>
@333fred 333fred mentioned this issue Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Bug good first issue The issue is reserved for a first time, non-Microsoft contributor help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Projects
None yet
Development

No branches or pull requests

3 participants