Skip to content

[AI-Suggested] Content update request from UUF signal: Use MessagePack Hub Protocol in SignalR for ASP.NET Core | Microsoft Learn #37998

Open

Description

@gewarren

Documentation Update: Use MessagePack Hub Protocol in SignalR for ASP.NET Core | Microsoft Learn

Customer Feedback

Page: Use MessagePack Hub Protocol in SignalR for ASP.NET Core | Microsoft Learn
Source File: https://github.com/dotnet/AspNetCore.Docs/blob/live/aspnetcore/signalr/messagepackhubprotocol.md

Summary

Clarify that CustomResolver in the server configuration snippet is a user-defined MessagePack-CSharp resolver (not a built-in type) and provide a runnable, minimal configuration using built-in resolvers (for example, StandardResolver/ContractlessStandardResolver) plus a concrete example of how to supply a custom resolver implementation.

Suggested Fixes

Instructions for Copilot: Copilot should only fix suggestions with a checkmark and do not make any updates for unchecked suggestions.

Note

Suggestions are generated by AI and they should be reviewed by human before assigning it to Copilot. Please uncheck the ones you don't want Copilot to work on. Then assign this issue to Agent (GitHub Copilot). When assigning it to Copilot you can enter additional instructions under "Optional Prompt" dialog.

  • In “Configure MessagePack on the server”, update the customization code snippet that currently uses new CustomResolver() to either (a) replace it with a built-in resolver example, or (b) explicitly label it as user-defined and include the required using statements and package note so the snippet is runnable. For example, replace the resolver line with a built-in resolver and show full snippet:

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

    Also add 1–2 sentences immediately before the snippet clarifying that resolvers come from MessagePack-CSharp and that CustomResolver is not provided by ASP.NET Core/SignalR.

  • If you want to keep the CustomResolver example, add a short, concrete subsection directly under the server customization paragraph (for example, “Example: creating a custom resolver”) that defines what it is and provides a minimal implementation (or a link to an official MessagePack-CSharp resolver example). Include a small code block that compiles, such as a composite resolver setup:

    using MessagePack;
    using MessagePack.Resolvers;
    
    // Example custom resolver composition
    var resolver = CompositeResolver.Create(
        // add any custom formatters/resolvers first
        StandardResolver.Instance
    );
    
    services.AddSignalR().AddMessagePackProtocol(options =>
    {
        options.SerializerOptions = MessagePackSerializerOptions.Standard
            .WithResolver(resolver)
            .WithSecurity(MessagePackSecurity.UntrustedData);
    });

    Add a brief note stating: “A ‘resolver’ is a MessagePack-CSharp concept (an IFormatterResolver) that controls how types are serialized; you only need a custom resolver if you are customizing type handling beyond the built-in resolvers.”


📚 To learn more about agentic content maintenance workflow, visit Agentic workflow for Learn content maintenance. Sign in using Learn Profile to access the content on this link.

💬 Share your feedback on the Learn Content Maintenance Agentic Workflow here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions