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

Changed options settings in ASP.NET Core SignalR MessagePack #20506

Closed
BrennanConroy opened this issue Apr 3, 2020 · 1 comment
Closed

Changed options settings in ASP.NET Core SignalR MessagePack #20506

BrennanConroy opened this issue Apr 3, 2020 · 1 comment
Labels
area-signalr Includes: SignalR clients and servers
Milestone

Comments

@BrennanConroy
Copy link
Member

Changed options settings in ASP.NET Core SignalR MessagePack

The ASP.NET Core SignalR MessagePack Hub Protocol options has been changed from a IList<MessagePack.IFormatterResolver> to use the MessagePackSerializerOptions from the MessagePack library directly.

This is a breaking change for:

Version introduced

5.0-preview4

Old behavior

Previously, you could add to the options as shown here:

services.AddSignalR()
    .AddMessagePackProtocol(options =>
    {
        options.FormatterResolvers.Add(MessagePack.Resolvers.StandardResolver.Instance);
    });

And replace the options as shown here:

services.AddSignalR()
    .AddMessagePackProtocol(options =>
    {
        options.FormatterResolvers = new List<MessagePack.IFormatterResolver>()
        {
            MessagePack.Resolvers.StandardResolver.Instance
        };
    });

New behavior

Now, you can add to the options with:

services.AddSignalR()
    .AddMessagePackProtocol(options =>
    {
        options.SerializerOptions =
            options.SerializeOptions.WithResolver(MessagePack.Resolvers.StandardResolver.Instance);
    });

And replace the options with:

services.AddSignalR()
    .AddMessagePackProtocol(options =>
    {
        options.SerializerOptions = MessagePackSerializerOptions
                .Standard
                .WithResolver(MessagePack.Resolvers.StandardResolver.Instance)
                .WithSecurity(MessagePackSecurity.UntrustedData);;
    });

Reason for change

This is part of our move the the MessagePack v2.x move which we announced in aspnet/Announcements#404. The v2.x library has added a new options API that is easier to use and provides more features than the list of MessagePack.IFormatterResolver that was exposed before.

Recommended action

If you are using the SignalR MessagePack Hub Protocol and modifying the options, update your usage to use the new options API as shown above.

Category

ASP.NET

Affected APIs

This is the discussion issue for the following announcement: aspnet/Announcements#413


Issue metadata

  • Issue type: breaking-change
@ghost
Copy link

ghost commented Dec 2, 2020

Thank you for contacting us. Due to a lack of activity on this discussion issue we're closing it in an effort to keep our backlog clean. If you believe there is a concern related to the ASP.NET Core framework, which hasn't been addressed yet, please file a new issue.

This issue will be locked after 30 more days of inactivity. If you still wish to discuss this subject after then, please create a new issue!

@ghost ghost closed this as completed Dec 2, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jan 1, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-signalr Includes: SignalR clients and servers
Projects
None yet
Development

No branches or pull requests

2 participants