Skip to content

Add polymorphic support to SignalR STJ #53035

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 1 commit into from
Jan 9, 2024
Merged

Conversation

BrennanConroy
Copy link
Member

Fixes #52342

@eiriktsarpalis is there any downside(s)/gotchas to calling JsonSerializer.Serialize without the actual type of the object?

void Write(object obj)
{
    JsonSerializer.Serialize(obj, obj.GetType(), options);
    // vs.
    JsonSerializer.Serialize(obj, options);
}

@BrennanConroy BrennanConroy added the area-signalr Includes: SignalR clients and servers label Dec 27, 2023
@eiriktsarpalis
Copy link
Member

is there any downside(s)/gotchas to calling JsonSerializer.Serialize without the actual type of the object?

Not really, if anything the overload without the Type argument should be faster in certain cases since it caches the most recently used type medata.

@BrennanConroy
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Member

@davidfowl davidfowl left a comment

Choose a reason for hiding this comment

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

For AOT, we'll need to pass in the type info AFAIK,.

@BrennanConroy BrennanConroy merged commit 7fbe600 into main Jan 9, 2024
@BrennanConroy BrennanConroy deleted the brecon/polymorphic branch January 9, 2024 05:02
@ghost ghost added this to the 9.0-preview1 milestone Jan 9, 2024
@TonEnfer
Copy link

TonEnfer commented Jan 9, 2024

Hello @BrennanConroy
Can we expect a fix for this in NET 8?

@ghost
Copy link

ghost commented Jan 9, 2024

Hi @TonEnfer. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context.

@BrennanConroy
Copy link
Member Author

Unlikely, this is feature work, not fixing a regression or a security concern.
https://github.com/dotnet/aspnetcore/blob/main/docs/Servicing.md#servicing-bar

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.

The JSON returned by SignalR does not contain the $type field
4 participants