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
This ports BinaryFormatter from desktop, along with all of the supporting types and general Formatter-related types. I've added a bunch of tests, bringing code coverage up to ~80%, though there's still more that can/should be done. I did not port remoting-specific functionality, though there are still some remnants I've left as they were enabled in the runtime even when remoting wasn't compiled in, and it wasn't clear if they were serving additional purposes.
Commit migrated from https://github.com/dotnet/corefx/commit/e45a01a4840700d75bb1dd3bf7d0e10ff6a3bc82
CoreFX tests will now compile against netstandard1.3 as references and will now deploy for the platforms listed in their respective supports clause, provided the appropriate TestTFM is passed in. The supports are fully listed inside runtime.json in the new TestSuite metapackage in buildtools. The tests will default to netcoreapp1.0 as their TestTFM.
CoreFx test projects now utilise a test csproj to pkgproj reference which determine the appropriate compile time and runtime assets needed.
Dependent on https://github.com/dotnet/buildtools/pull/770
Commit migrated from https://github.com/dotnet/corefx/commit/b4841454de7ddcd75e92e2bb24ebb238a82df43f
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