-
Notifications
You must be signed in to change notification settings - Fork 4k
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
When a text buffer does not represent a document from a workspace Get… #24937
Conversation
I'm guessing you want this in dev15.7.x? This also seems like one of those "how did we ever miss this before..."...is there something subtle here or is this PR as obvious as it looks? |
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.
Change is fine; I suspect you want this in dev15.7.x though.
I guess it'd be nice to have in dev15.7.x, but it's not exactly blocking. What would I need to do to get this into dev15.7.x? Make a new PR, or retarget, rebase and force push this one? Yes, it's just a simple null check, nothing non-obvious here. I'm guessing there aren't a lot of cases where a CSharp content-type buffer is not added to any workspace. |
@Pilchie for Ask mode bar check |
Yes, I'd be willing to take this for 15.7. |
…OpenDocumentInCurrentContextWithChanges() will return null. Allow for that without a NullReferenceException. Fixes dotnet#24625.
485c72b
to
7d3b82a
Compare
Retargeted to |
@Pilchie Retargeted, and looks like ask mode template already filled out. |
@jasonmalinowski @KirillOsenkov - test failure? https://ci.dot.net/job/dotnet_roslyn/job/dev15.7.x/job/windows_release_unit64_prtest/359/. Approved pending that being figured out. |
@dotnet-bot retest windows_release_unit32_prtest please. |
…OpenDocumentInCurrentContextWithChanges() will return null. Allow for that without a NullReferenceException.
Fixes #24625.
Ask Mode template
Customer scenario
In cases where the editor is hosting text with C# content type, but it's not added to any workspace, there is a null reference exception thrown because document is null. It may or may not be fatal depending on the circumstances (i.e. how the editor is hosted).
Bugs this fixes
#24625
Workarounds, if any
Don't host C# files without adding them to a workspace
Risk
Very low risk, just a null check.
Performance impact
A null check - no discernible perf impact.
Is this a regression from a previous update?
Root cause analysis
Need the new "Nullable Reference Types" to catch nullrefs early.
How was the bug found?
Hosting Roslyn outside of Visual Studio (VSMac, etc).
Test documentation updated?