We need BinaryFormatter to be able to serialize types from coreclr that use the various serialization types (e.g. ISerializable), which means those types must have the same identity as the ones BinaryFormatter recognizes, and we need a bunch of types all across corefx to be able to use these same types to implement serialization. As such, the types are moving down to System.Runtime, and on coreclr, are type-forwarding to the implementations there.
There are a few outstanding issues:
- SR is not currently available in System.Runtime. The few uses of SR in the versions of the code used for corert have been replaced by hardcoded strings and TODOs.
- Debug.Assert is not currently available in System.Runtime. Asserts have been commented out with TODOs.
- To get things to build as types are moving around, P2P references are used.
Commit migrated from https://github.com/dotnet/corefx/commit/90be35920b48820536b8740f64d565ded55d811e
We decided to add binary serialization programming model (ISerializable, etc.) as an out of band package.
This will allow existing code implementing the SPM to compile for .NET Core without changes.
This is the ferst in a series of commits to ease porting of code involving serialization.
In subsequent commits, we are planing to:
1. Fill in the details of SerializationInfo
2. Add Exception.set_StackTrace
3. Add FormatterServices.GetUninitializedObject
4. Add BinaryFormatter (the exact semantics TBD)
Commit migrated from https://github.com/dotnet/corefx/commit/db70c8e2ba100b2f0f8fa1ace82dd1988200b269