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

When a text buffer does not represent a document from a workspace Get… #24937

Merged
merged 1 commit into from
Mar 15, 2018

Conversation

KirillOsenkov
Copy link
Member

@KirillOsenkov KirillOsenkov commented Feb 19, 2018

…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?

@jasonmalinowski
Copy link
Member

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?

Copy link
Member

@jasonmalinowski jasonmalinowski left a 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.

@KirillOsenkov
Copy link
Member Author

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.

@jinujoseph
Copy link
Contributor

@Pilchie for Ask mode bar check
@KirillOsenkov , once approved you can retarget to dev15.7.x branch

@Pilchie
Copy link
Member

Pilchie commented Feb 22, 2018

Yes, I'd be willing to take this for 15.7.

…OpenDocumentInCurrentContextWithChanges() will return null. Allow for that without a NullReferenceException.

Fixes dotnet#24625.
@KirillOsenkov
Copy link
Member Author

Retargeted to dev15.7.x

@jasonmalinowski
Copy link
Member

@Pilchie Retargeted, and looks like ask mode template already filled out.

@Pilchie
Copy link
Member

Pilchie commented Feb 22, 2018

@jasonmalinowski
Copy link
Member

@dotnet-bot retest windows_release_unit32_prtest please.

@jasonmalinowski jasonmalinowski merged commit 599d45e into dotnet:dev15.7.x Mar 15, 2018
@KirillOsenkov KirillOsenkov deleted the Fix24625 branch March 15, 2018 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants