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

SignalR's JSON protocol does not support polymorphic serialization on streaming methods #54227

Closed
1 task done
Tragetaschen opened this issue Feb 26, 2024 · 2 comments
Closed
1 task done
Labels
area-signalr Includes: SignalR clients and servers

Comments

@Tragetaschen
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

In #47859, most of ASP.NET Core learned to serialize a polymorphic JSON hierarchy, but SignalR was omitted and still doesn't include the type discriminator declared on the base type, for example when streaming from server to client.

It would be great if this difference would not exist.

For me, the workaround of declaring the derived classes [JsonPolymorphic] etc. works.

Expected Behavior

Streaming a base type from server to client should include the type discriminator.

Steps To Reproduce

public class MyHub: Hub
{
    public async IAsyncEnumerable<BaseMessage> GetMessages()
    {
        yield return new DerivedMessage();
    }
}

Exceptions (if any)

No response

.NET Version

8.0.2

Anything else?

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-signalr Includes: SignalR clients and servers label Feb 26, 2024
@BrennanConroy
Copy link
Member

Probably dupe of #52342
Polymorphic support is added in 9.0, try that.

@Tragetaschen
Copy link
Contributor Author

Yes, this looks very much like a dupe, should've searched the PRs as well…

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

No branches or pull requests

2 participants