-
Notifications
You must be signed in to change notification settings - Fork 196
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 some AssumeNotNull
assumptions
#10901
Conversation
AssumeNotNull
assumptions
@@ -30,6 +29,5 @@ public static TextChange GetTextChange(this SourceText text, TextEdit edit) | |||
=> new(text.GetTextSpan(edit.Range), edit.NewText); | |||
|
|||
public static TextEdit GetTextEdit(this SourceText text, TextChange change) | |||
=> RoslynLspFactory.CreateTextEdit(text.GetRange(change.Span), change.NewText.AssumeNotNull()); | |||
|
|||
=> RoslynLspFactory.CreateTextEdit(text.GetRange(change.Span), change.NewText ?? ""); |
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.
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.
IIRC, it does make a difference, but an absurdly small one. 😄
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 thought it didn't make a difference after .NET Framework 2.0 🤷♂️
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.
No, it definitely made a difference in .NET Framework 2.0. There was actually effort to inline string.Empty
for empty string literals in the JIT more aggressively post .NET Framework 4.0. I know that because it caused a bug that @jasonmalinowski and I ran into where the value of string.Empty
could become corrupted by the COM marshaller if strings were annotated incorrectly (e.g. BStr
instead of LPWStr
).
Crazy days.
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.
Merging a PR from a plane... for the memes |
Fixes most of the hits on https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2223687 in 17.12 P2 and above