Skip to content

Revert part of "Add base interface for IHubContext (#33443)" #34174

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 3 commits into from
Jul 8, 2021

Conversation

BrennanConroy
Copy link
Member

Original change #33443

The change is a breaking change:

❌ DISALLOWED: Adding an interface to the set of base types of an interface

Apps rolling forward from a 5.0 runtime to a 6.0 runtime would break (if using SignalR obviously)

Keeping the out THub change as it isn't a binary breaking change I believe. It can be a behavior breaking change in extremely rare scenarios that no one is doing probably.

class BaseHub : Hub
{}

class DerivedHub : BaseHub
{}

if (x is IHubContext<BaseHub>)
{
    // now matches for IHubContext<DerivedHub>
}
else if (x is IHubContext<DerivedHub>)
{
}

@BrennanConroy BrennanConroy added the area-signalr Includes: SignalR clients and servers label Jul 7, 2021
/// <summary>
/// A context abstraction for a hub.
/// </summary>
public interface IHubContext<out THub> : IHubContext where THub : Hub
Copy link
Member

Choose a reason for hiding this comment

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

Keep the non generic interface and implement it on the concrete type so the original scenario is still possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-signalr Includes: SignalR clients and servers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants