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

asp.net core SignalR 3.1.9 incompatible with System.Text.Json 5 #27519

Closed
ChristophHornung opened this issue Nov 4, 2020 · 9 comments
Closed
Assignees
Labels
area-signalr Includes: SignalR clients and servers
Milestone

Comments

@ChristophHornung
Copy link

In System.Text.Json the API will change in version 5. Especially the type parameter in JsonSerializer.Serialize. The function now throws an exception when null is passed. (see this issue)

This is fixed in the latest SignalR 5 code (see e.g. the null check before this call here) but since System.Text.Json is a very common dependency once updated SignalR 3.1.9 will no longer work.

Will there be a new 3.x release to fix this problem? I already encountered that problem when testing an update to the latest EF 5 RC version.

@mkArtakMSFT mkArtakMSFT added the area-signalr Includes: SignalR clients and servers label Nov 4, 2020
@BrennanConroy
Copy link
Member

This issue is only happening in a client application right? Where you kept the SignalR client as 3.1.x and moved other dependencies to 5.0?

@ChristophHornung
Copy link
Author

No, this is on the server side. The exception occurs inside the method I linked (JsonHubProtocol.WriteCompletionMessage).

@BrennanConroy
Copy link
Member

Yeah I know where the issue is. How are you getting this in a server application? Are you targeting netcoreapp3.1 and pulling in 5.0 dependencies?

@ChristophHornung
Copy link
Author

I am targeting netcoreapp3.1 in an asp.net core project and updated Entity Framework Core to version 5 RC2, this in turn pulls in the latest System.Text.Json as a dependent package.

@BrennanConroy
Copy link
Member

Ok thanks, so two different scenarios are broken with the System.Text.Json changes. That'll help us prioritize.

Side-note: Why aren't you targeting net5.0 if you're pulling in 5.0 packages?

@ChristophHornung
Copy link
Author

I am currently testing the upgrade path for several parts of our code base towards net5.0, this change was part of testing whether a list of libraries we use can be upgraded without a problem. (Some of our services run on azure, and since we are not deploying as self-contained at the moment I am not sure I can easily switch over immediately).

I am pretty confident though that there will still remain a lot of signalR 3.x services running that will probably at some point in the future have implicit references to System.Text.Json in the latest version.

Since EF core 5 runs on .net core 3.1 this will probably happen very quickly, since we want to use a few of the new features without a full .net5 upgrade.

@jkotalik
Copy link
Contributor

jkotalik commented Nov 4, 2020

Looks like we need to make a fix to 3.1 in SignalR to not pass null to the JsonSerializerTo/From.

@BrennanConroy
Copy link
Member

Done via #27534

@BrennanConroy BrennanConroy modified the milestones: 3.1.x, 3.1.11 Nov 10, 2020
@ChristophHornung
Copy link
Author

@BrennanConroy Hey Brennan, just wanted to say thanks for the quick replies and the quick fix. Your work is appreciated!

@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2020
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

4 participants