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

Remove binary serialization #465

Merged
merged 1 commit into from Dec 22, 2023
Merged

Conversation

iamcarbon
Copy link
Sponsor Contributor

Binary serialization support is no longer recommended as .NET5.0 and is obsoleted entirely in .NET 8.0 in preparation for its removal in .NET 9.0.

https://github.com/dotnet/designs/blob/main/accepted/2020/better-obsoletion/binaryformatter-obsoletion.md

This PR removes binary serialization support on Exceptions (and eliminates the warnings when targeting .NET8.0) -- and helps ensure no-one relies on these when support is removed in .NET 9.0.

@iamcarbon
Copy link
Sponsor Contributor Author

@abergs Ready for review.

@abergs
Copy link
Collaborator

abergs commented Nov 18, 2023

@iamcarbon what side effects would this cause?

@iamcarbon
Copy link
Sponsor Contributor Author

iamcarbon commented Nov 22, 2023

Users serializing exceptions using the BinaryFormatter would no longer work. This was common on the .NET Framework where logging libraries would intercept errors and log them somewhere. I don't think this pattern ever carried over to .NET core, and I'm unaware of any modern libraries that still use the BinaryFormatter. New exceptions introduced to modern .NET haven't been annotated for years, and we never annotated all our exceptions in this library either.

If someone happens to be using binary serialization on modern .NET, they should be migrating away ASAP. The BinaryFormatter is obsolete, unsafe, and being prepared for removal in .NET 9.0.

Screenshot 2023-11-22 at 10 48 56 AM

https://learn.microsoft.com/en-us/dotnet/api/system.runtime.serialization.formatters.binary.binaryformatter?view=net-8.0

@iamcarbon
Copy link
Sponsor Contributor Author

@aseigler Let me know if you see any reason not keep these around. These attributes cause an error on .NET 8.0 and will be need to be suppressed if we want to continue to support them on .NET 6.0.

@abergs abergs merged commit 5284757 into passwordless-lib:master Dec 22, 2023
10 of 11 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants