Skip to content

Add an extension method Users to IHubClients witch takes IEnumerable parameter #17360

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

Merged
merged 5 commits into from
Dec 18, 2019

Conversation

Marusyk
Copy link
Member

@Marusyk Marusyk commented Nov 23, 2019

Add a simple extension method toIHubClients witch takes IEnumerable parameter

Addresses #17285

Please review
Thank you in advance

@Marusyk Marusyk force-pushed the marusyk/IHubClients branch from abd2cc1 to 500ab60 Compare November 24, 2019 00:39
@BrennanConroy BrennanConroy added the area-signalr Includes: SignalR clients and servers label Nov 24, 2019
@BrennanConroy BrennanConroy added this to the 5.0.0-preview1 milestone Nov 24, 2019
@analogrelay
Copy link
Contributor

We should add this to all the client methods if we're going to do it (Groups, GroupsExcept, etc. etc. etc.). Also, we need to discuss if an extension method is right or if we should use a Default Interface Member. The latter would allow an implementation to override it and provide different logic for IEnumerable over IReadOnlyList.

Thoughts on this @davidfowl @halter73 @BrennanConroy ?

@halter73
Copy link
Member

halter73 commented Nov 25, 2019

I agree we should do the same for Groups, GroupsExcept, etc... I think for something as trivial as this, an extension method is still appropriate. I don't know why an interface implementor would want to do anything special for IEnumerable vs IReadOnlyList

@Marusyk
Copy link
Member Author

Marusyk commented Dec 4, 2019

Can anybody suggest how to fix build and what is Pull Request Labeler?

@halter73 halter73 added the api-ready-for-review API is ready for formal API review - https://github.com/dotnet/apireviews label Dec 4, 2019
@halter73
Copy link
Member

halter73 commented Dec 4, 2019

Can anybody suggest how to fix build and what is Pull Request Labeler?

https://github.com/aspnet/AspNetCore/blob/master/docs/ReferenceAssemblies.md#when-changing-public-api

@aspnet/asp-net-api-reviews We'll want to do an API review on this before merging.

I wouldn't worry about the PR labeler. That doesn't block the build. I don't even think it's supposed to run for external PRs (#15171) @mkArtakMSFT Do you know what's going on here?

@Marusyk
Copy link
Member Author

Marusyk commented Dec 4, 2019

@analogrelay
Copy link
Contributor

I can't build locally because /docs/BuildFromSource.md@master#common-error-unable-to-locate-the-net-core-sdk

Have you enabled the "Use previews of the .NET Core SDK" checkbox as suggested in that doc?

Even if you can't fully build, you may still be able to run the script @halter73 mentioned to update the ref assembly. Updating that is necessary to resolve the Code Check failure.

@Marusyk
Copy link
Member Author

Marusyk commented Dec 7, 2019

thanks,
the problem was in path (env variable)

@analogrelay
Copy link
Contributor

Excellent! Thanks!

A note here about the process from here:

  1. Someone from the team needs to review this and sign off (ping @halter73 @BrennanConroy ;)).

  2. We'll review the new API in our regular API review meeting (we do this for all public API changes in mature areas like SignalR) and either approve it or provide further feedback.

Once we've got those done, we'll merge it in!

@Marusyk Marusyk force-pushed the marusyk/IHubClients branch from c8418b9 to 4a2103a Compare December 11, 2019 23:06
Copy link
Contributor

@pranavkm pranavkm left a comment

Choose a reason for hiding this comment

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

We want to make sure this isn't a source breaking change

@pranavkm pranavkm added api-approved API was approved in API review, it can be implemented and removed api-ready-for-review API is ready for formal API review - https://github.com/dotnet/apireviews labels Dec 16, 2019
@rynowak
Copy link
Member

rynowak commented Dec 16, 2019

We want to make sure this isn't a source breaking change

Specifically we should make sure that using array or list here doesn't lead to an ambiguity compiler diagnostic.

@halter73
Copy link
Member

I tried this with an Array, List and IEnumerable (which was really an Array stored as an IEnumerable). Since both Array and List implement IReadOnlyList and IReadOnlyList inherits from IEnumerable, the compiler chooses the more-derived IReadOnlyList overload. In the IEnumerable case, the compiler chooses the IEnumerable extension method since that's the only workable overload.

Overload selection is a compile-time decision, so an Array/List/whatever can still be passed to the IEnumerable extension method if the compiler only knows it's an IEnumerable, but I don't see a problem with that.

@halter73 halter73 merged commit bc0c712 into dotnet:master Dec 18, 2019
@halter73
Copy link
Member

Thanks @Marusyk.

@Marusyk Marusyk deleted the marusyk/IHubClients branch December 18, 2019 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-approved API was approved in API review, it can be implemented area-signalr Includes: SignalR clients and servers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants