-
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
Fix null encoding in new document in move type action #74623
Fix null encoding in new document in move type action #74623
Conversation
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.
seems reasonable. @tmat @jasonmalinowski any concerns?
@tmat ccan you ptal? |
src/Workspaces/Core/Portable/Workspace/Solution/DocumentState.cs
Outdated
Show resolved
Hide resolved
@tmat could you please review this? |
@tmat another reminder to review this |
|
@tmat ptal at the changed tests and review |
@tmat ready for review |
1 similar comment
@tmat ready for review |
Set to auto-merge. If we don't want this, please speak up @tmat |
Head branch was pushed to by a user without write access
@jasonmalinowski ptal. |
encoding = null; | ||
} | ||
// use the encoding that we get from the new root | ||
var encoding = newRoot.SyntaxTree.Encoding; |
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.
@jasonmalinowski I don't have context on the previous logic. Should it ask be removed (like the current pr does it), it should we just fall back to getting the encoding from the tree if the other checks fail?
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.
Note the previous comment from tmat: #74623 (comment)
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.
Ok. Seems reasonable. Merging in. If you have any concerns @jason let us know
Closes #72984
Summary
We default to receiving the encoding set in the new node we are requested to create the new document with in
DocumentState
.A new test was added to test how hot reload reacts by applying the code fix that contained the null encoding bug, and applying actual code changes after performing the move type. It seems that the bug was not being triggered if the code fix had no changes to apply, i.e. the code remained the exact same, and all that changed was the location of the moved type.