Skip to content

Obsolete SerializationFormat.Binary in DataTable/DataSet and put it behind an appcontext switch #39289

@GrabYourPitchforks

Description

@GrabYourPitchforks

Ref:

for (int i = 0; i < Tables.Count; i++)
{
BinaryFormatter bf = new BinaryFormatter(null, new StreamingContext(context.State, false));
MemoryStream memStream = new MemoryStream();
bf.Serialize(memStream, Tables[i]);
memStream.Position = 0;
info.AddValue(string.Format(CultureInfo.InvariantCulture, "DataSet.Tables_{0}", i), memStream.GetBuffer());
}

//Tables, Columns, Rows
for (int i = 0; i < tableCount; i++)
{
byte[] buffer = (byte[])info.GetValue(string.Format(CultureInfo.InvariantCulture, "DataSet.Tables_{0}", i), typeof(byte[]))!;
MemoryStream memStream = new MemoryStream(buffer);
memStream.Position = 0;
BinaryFormatter bf = new BinaryFormatter(null, new StreamingContext(context.State, false));
DataTable dt = (DataTable)bf.Deserialize(memStream);
Tables.Add(dt);
}

This issue tracks the removal of this code per the BinaryFormatter obsoletion plan.

From offline discussions with Arthur and friends, we may want to eliminate support for SerializationFormat.Binary anyway, since it's not compatible between .NET Framework and .NET Core / .NET 5.0+. The only data format compatible between the different runtimes is SerializationFormat.Xml.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions