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

Fallback to ILBasedSerializer when BinaryFormatter is disabled #7198

Conversation

ReubenBond
Copy link
Member

Fix for #7028 & #6805.
Developers can enable BinaryFormatter on .NET 5.0+ using the workaround here: #6805 (comment)
Otherwise, ILBasedSerializer will be used as the fallback on .NET 5.0+

@ReubenBond ReubenBond added this to the 3.5.0 milestone Aug 13, 2021
@ReubenBond ReubenBond force-pushed the fix/binaryformatter-deprecation-fallback-fallback branch from 454dea3 to d428a35 Compare August 13, 2021 22:08
@ReubenBond ReubenBond force-pushed the fix/binaryformatter-deprecation-fallback-fallback branch from d428a35 to aedbc6e Compare August 14, 2021 15:50
@benjaminpetit benjaminpetit merged commit c9b495a into dotnet:3.5.0 Aug 16, 2021
@turowicz
Copy link

turowicz commented Sep 3, 2021

@ReubenBond which formatter should we prefer? The unsafe one?

@ReubenBond ReubenBond deleted the fix/binaryformatter-deprecation-fallback-fallback branch September 3, 2021 13:49
@ReubenBond
Copy link
Member Author

I would stick with what works for now. They are only used as a fallback, eg for exceptions.

@SebastianStehle
Copy link
Contributor

What is the long term plan here?

I thought ILBasedSerializer has been marked as obsolete and a new serializer has been developed a while ago but is not stable?

And how do these serializers with exceptions that have custom properties?

@ReubenBond
Copy link
Member Author

ReubenBond commented Sep 3, 2021

@SebastianStehle yes, it was a roller coaster: ILBasedSerializer was developed in response to BinaryFormatter's removal from early .NET Core versions (1.0?). It was eventually marked [Obsolete] when the .NET team reversed that decision, since we didn't want another serializer just for the sake of it. BinaryFomatter was selected as the default. Now that BinaryFormatter has actually been disabled for .NET 5.0 and above, we are back to using ILBasedSerializer where necessary. We should probably remove the [Obsolete] attribute from it, since it's really the only option for Orleans 3.x on .NET 5.0 without explicitly opting-in to allowing it.

The long term plan is already in-place in main:

  • A new, version-tolerant serializer has been added, which supports exceptions with a fallback exception type
  • ILBasedSerialier is entirely removed
  • All other serializers are entirely removed except for OrleansJsonSerializer, which is still there to configure Newtonsoft.Json.
  • (in-progress) Grain persistence supports per-provider configurable serializers

We will likely need some options for developers who are serializing grain state using the current serialization framework, at some point. 4.x is not wire-compatible with 3.x, so rolling upgrades are not supported between those major versions.

@SebastianStehle
Copy link
Contributor

Thanks a lot of your good explanation.

benjaminpetit pushed a commit to benjaminpetit/orleans that referenced this pull request Sep 22, 2021
…t#7198)

* Fallback to ILBasedSerializer when BinaryFormatter appears to be disabled at runtime

* Multi-target tests to .NET 5.0 and fix subsequent errors and warnings
ReubenBond added a commit that referenced this pull request Sep 22, 2021
* Fallback to ILBasedSerializer when BinaryFormatter appears to be disabled at runtime

* Multi-target tests to .NET 5.0 and fix subsequent errors and warnings
@github-actions github-actions bot locked and limited conversation to collaborators Dec 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants