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

Fixed declaration name completion regression #1520

Merged
merged 5 commits into from
Jun 6, 2019

Conversation

filipw
Copy link
Member

@filipw filipw commented Jun 5, 2019

With one of the recent Roslyn betas, we have (or rather Roslyn has) regressed on declaration name completion - it doesn't work for us anymore at all.
There was no test for that, so it went unnoticed - the test is added in this PR now.

The root cause is here http://source.roslyn.io/#Microsoft.CodeAnalysis.CSharp.Features/Completion/CompletionProviders/DeclarationNameCompletionProvider.cs,70 Roslyn actually swallows all exceptions for DeclarationNameCompletionProvider. With the current beta, Roslyn actually throws as it can't find a reference to Humanizer. It is a bug in Roslyn since this package is required at runtime but not listed as dependency of the Roslyn Nuget.

Adding the package directly restores our old behavior and the declaration name completion works again (I tested in the editor too). I will open this as bug in Roslyn but until it's resolved, we should take in this fix.

Copy link

@rchande rchande left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. Thanks!

Copy link
Member

@bjorkstromm bjorkstromm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, what? Roslyn has a dependency on Humanizer?

@filipw
Copy link
Member Author

filipw commented Jun 5, 2019

Wait, what? Roslyn has a dependency on Humanizer?

yes, for pluralization https://github.com/dotnet/roslyn/blob/master/src/Features/CSharp/Portable/Completion/CompletionProviders/DeclarationNameCompletionProvider.NameGenerator.cs#L5
I think @rchande even implemented it at some point? 😀

@bjorkstromm
Copy link
Member

Did you @filipw open an issue in Roslyn so that they’ll list Humanizer as a dependency?

@bjorkstromm
Copy link
Member

I think @rchande even implemented it at some point? 😀

Yes, saw that. It was back in 2017. How come we haven’t seen any issue with missing references before? Was it because Roslyn was swallowing exceptions?

@filipw filipw force-pushed the bugfix/declaration-completion branch from f4b4732 to 5a6e450 Compare June 5, 2019 19:32
@filipw
Copy link
Member Author

filipw commented Jun 5, 2019

Yes, saw that. It was back in 2017. How come we haven’t seen any issue with missing references before? Was it because Roslyn was swallowing exceptions?

it used to work.
Look at the older version - https://www.nuget.org/packages/Microsoft.CodeAnalysis.CSharp.Features/2.10.0 the Humanizer dependency is there
However it's missing in the 3.x.x versions and it doesn't work anymore. It doesn't crash completion since Roslyn simply swallows the exception.

as I wrote in the PR, I'll open a Roslyn bug for this, but for now this gives an immediate fix - and resolves the regression that we suffered when we moved to Roslyn 3.x

@rchande
Copy link

rchande commented Jun 5, 2019

@filipw Yeah, sounds like they messed up the package authoring somehow. Thanks for working around/filing the bug.

@filipw filipw merged commit 8b37221 into OmniSharp:master Jun 6, 2019
@filipw filipw deleted the bugfix/declaration-completion branch June 6, 2019 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants