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 BinaryFormatter Replacement Mode #105

Open
agenne opened this issue Oct 26, 2022 · 3 comments
Open

Support for BinaryFormatter Replacement Mode #105

agenne opened this issue Oct 26, 2022 · 3 comments
Assignees

Comments

@agenne
Copy link

agenne commented Oct 26, 2022

Hi, because of BinaryFormatter deprecation we are looking for alternatives.
MessagePack for C# isn't one due to not supported cyclic references.
Ceras looks good so far.

For binary formatter our developers are decorating the classes using the [Serializable] Attribute.
If they have Data which should not be serialized, they use the [NonSerialzed] Attribute on Fields. (only on fields possible)

There are tons of code like this:

[Serializable]
public class Sample
{
[NonSerialized]
private int fMyProperty1;

public int MyProperty1 { get => fMyProperty1; set => fMyProperty1 = value; }

public int MyProperty2 { get; set; }

}

In Order to get it working we have to change this tons of code into:
[Serializable]
[MemberConfig(TargetMember.All)]
public class Sample
{
[NonSerialized]
[Exclude]
private int fMyProperty1;

[Exclude]
public int MyProperty1 { get => fMyProperty1; set => fMyProperty1 = value; }

public int MyProperty2 { get; set; }

}

Question 1:

Is there any chance to provide a BinaryFormatter Replacement Mode?
This mode should use existing attributes and not require attributes on fields AND properties.

Question 2:

YES, we also add fields and properties to our classes during the further development and we assume that this makes no problems on deserialization. Of course we accept compromises in volume.

Is that possible or will it be possible?

Thank You in advance
Best Regards

@GunSharp
Copy link

GunSharp commented May 8, 2024

Hi Agenne,

Forgive my bluntness but did you manage to find a working solution for the replacement of the dotnet binary formatter/serialisation?

Thank you for your reply...

@alexgenne
Copy link

Hi GunSharp,
unfortunately no, either we will use the unsupported Formatter which will be provided by MS as Nuget-Package, or we will copy the code from .NET 8 and move it to our source base.

@GunSharp
Copy link

GunSharp commented May 8, 2024

Hi Alexgenne,
Thank you for your reply & info!

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

4 participants