-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Do not return empty nodes in the refactoring helpers service. #58830
Conversation
ab7680a
to
18721c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the fix could be in line 137 (AbstractAddParameterCheckCodeRefactoringProvider.cs
), which might be missing getInnermostNodeForTie: true
var firstParameterNode = (TParameterSyntax)root.FindNode(parameterSpan);
The challenge is to find a test case. Is there any scenario where the syntax tree can contain a ParameterList with missing parenthesis? this is a case where the ParameterSyntax and ParameterListSyntax might have the same span, so the cast will fail.
This could cause a problem for simple lambdas, where the parameter span is the same as the identifier span. |
Yes, i thought that was likely teh case too. However, i still can't figure out a repro for this. As such, i didn't want to make a change that doesn't certainly fix things. This change at least lets us know what is going on so we can narrow this down :) |
Technically that would be ok as this is FindNode and the 'identifier' is a token. That said, i still can't figure out how FindNode, when given the span of a parameter, is getting the ParameterList back instead. Taht's the weird thing here. |
/azp run |
Going to see if #58845 can hint to a repro |
actually i have a theory. let me try out parameters that are missing. that might cause some issues here. |
Azure Pipelines successfully started running 4 pipeline(s). |
Yes. This is the case that hits this. |
Fixes #58811