Closed
Description
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