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

Support for JsonSerializer.Context when StreamingContext is removed #2953

Open
jdom opened this issue May 15, 2024 · 2 comments
Open

Support for JsonSerializer.Context when StreamingContext is removed #2953

jdom opened this issue May 15, 2024 · 2 comments

Comments

@jdom
Copy link
Contributor

jdom commented May 15, 2024

Since the StreamingContext type is Obsolete in .NET 8, is there a future plan for supporting a serialization context in the future?
StreamingContext was used in the BinaryFormatter infrastructure, which is going away, although Newtonsoft.Json uses this type for non-BinaryFormatter purposes.
The current workaround is to suppress the warning when using the JsonSerializer.Context property (when newing up StreamingContext actually), but it's not ideal.

If I read the BinaryFormatter obsoletion roadmap correctly, the type will not be removed in future versions (hopefully), so it might not be completely blocking given the workaround, but it's still worth some consideration.

@elgonzo
Copy link

elgonzo commented May 15, 2024

EDIT: Oh, never mind, my apologies. Ignore my comment please, i didn't notice you're a Microsoft guy...

> is there a future plan for supporting a serialization context in the future?

In my opinion, since quite a while already Newtonsoft.Json is basically a legacy library in maintenance mode, with System.Text.Json being the modern .NET json serializer that is in active development and part of the .NET BCL. Don't get you hopes up for Newtonsoft.Json receiving any noteworthy new features. If you need to maintain Newtonsoft.Json in an existing project, the workaround is (and quite likely will remain in the future) suppression of the SYSLIB0050 obsoletion warning for the StreamingContext ctor's.

@jdom
Copy link
Contributor Author

jdom commented May 16, 2024

Thanks @elgonzo , I think your opinion is valid, as I expected this too as a way to mark this issue as by design, if we believe we won't be blocked by it in the future.
I do work at Microsoft, but I'm not in the .NET team, so for this issue I'm just a random consumer of the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants