Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Move serialization primitives to System.Runtime #10388

Closed

Conversation

stephentoub
Copy link
Member

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.

(Once this is in place, I'll be able to finish up deploying serialization throughout corefx; I have a partially completed local branch adding all of that in.)

cc: @weshaggard, @ericstj, @danmosemsft, @KrzysztofCwalina, @joperezr

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.
@stephentoub stephentoub force-pushed the move_serialization_primitives branch from d2c90a1 to 7812bc2 Compare July 28, 2016 12:47
@@ -12,6 +12,8 @@
</ItemGroup>
<ItemGroup>
<None Include="project.json" />
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be broken after I merge my changes because now this reference will be to the 4.2 version of the assembly, but the implementation will still just get 4.1 causing a mismatch. To make this not break my code, could you try adding a target group on all of this P2P references? This will let you still reference the 4.1 version of the assembly after my change. This is more or less what I'm suggesting:

<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj">
   <TargetGroup>netstandard1.5</TargetGroup>
</ProjectReference>

I believe that if you do that, it will work before and after my change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joperezr this is the ref which only has one build the latest netstandard1.7 version, so I think the ProjectReference @stephentoub has will work.

@joperezr
Copy link
Member

Same comments on the rest of P2P references

@@ -12,6 +12,8 @@
</ItemGroup>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that you are depending on the netstandard1.7 version of System.Runtime you will also need to update the netstandard version of this library to match it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am hitting a failure in CI, but only on Windows. Any idea how I fix this?

Error : Multiple projects built twice with the same target path D:\j\workspace\windows_nt_de---0cbbd14c\bin\ref\System.Runtime\4.1.1.0\System.Runtime.dll.
D:\j\workspace\windows_nt_de---0cbbd14c\build.proj -->
  Global Properties:
    ConfigurationGroup = Debug
    OSGroup = Windows_NT
    WithoutCategories = IgnoreForCI
D:\j\workspace\windows_nt_de---0cbbd14c\src\dirs.proj -->
  Global Properties:
    ConfigurationGroup = Debug
    WithoutCategories = IgnoreForCI
    DefaultBuildAllTarget = Build
    BuildAllProjects = true
    InputOSGroup = Windows_NT
    FilterToOSGroup = Windows_NT
D:\j\workspace\windows_nt_de---0cbbd14c\src\src.builds -->
  Global Properties:
    ConfigurationGroup = Debug
    WithoutCategories = IgnoreForCI
    DefaultBuildAllTarget = Build
    BuildAllProjects = true
    InputOSGroup = Windows_NT
    FilterToOSGroup = Windows_NT
D:\j\workspace\windows_nt_de---0cbbd14c\src\System.Runtime.Serialization.Primitives\src\System.Runtime.Serialization.Primitives.builds -->
  Global Properties:
    ConfigurationGroup = Debug
    WithoutCategories = IgnoreForCI
    DefaultBuildAllTarget = Build
    BuildAllProjects = true
    InputOSGroup = Windows_NT
    FilterToOSGroup = Windows_NT
D:\j\workspace\windows_nt_de---0cbbd14c\src\System.Runtime.Serialization.Primitives\src\System.Runtime.Serialization.Primitives.csproj -->
  Global Properties:
    ConfigurationGroup = Debug
    WithoutCategories = IgnoreForCI
    BuildAllProjects = true
    InputOSGroup = Windows_NT
    OSGroup = Windows_NT
    TargetGroup = netcore50aot
D:\j\workspace\windows_nt_de---0cbbd14c\src\System.Runtime\ref\System.Runtime.csproj
  Global Properties:
    ConfigurationGroup = Debug
    WithoutCategories = IgnoreForCI
    BuildAllProjects = true
    InputOSGroup = Windows_NT
    OSGroup = Windows_NT
    TargetGroup = netcore50aot

D:\j\workspace\windows_nt_de---0cbbd14c\build.proj -->
  Global Properties:
    ConfigurationGroup = Debug
    OSGroup = Windows_NT
    WithoutCategories = IgnoreForCI
D:\j\workspace\windows_nt_de---0cbbd14c\src\dirs.proj -->
  Global Properties:
    ConfigurationGroup = Debug
    WithoutCategories = IgnoreForCI
    DefaultBuildAllTarget = Build
    BuildAllProjects = true
    InputOSGroup = Windows_NT
    FilterToOSGroup = Windows_NT
D:\j\workspace\windows_nt_de---0cbbd14c\src\src.builds -->
  Global Properties:
    ConfigurationGroup = Debug
    WithoutCategories = IgnoreForCI
    DefaultBuildAllTarget = Build
    BuildAllProjects = true
    InputOSGroup = Windows_NT
    FilterToOSGroup = Windows_NT
D:\j\workspace\windows_nt_de---0cbbd14c\src\System.Collections\src\System.Collections.builds -->
  Global Properties:
    ConfigurationGroup = Debug
    WithoutCategories = IgnoreForCI
    DefaultBuildAllTarget = Build
    BuildAllProjects = true
    InputOSGroup = Windows_NT
    FilterToOSGroup = Windows_NT
D:\j\workspace\windows_nt_de---0cbbd14c\src\System.Collections\src\System.Collections.csproj -->
  Global Properties:
    ConfigurationGroup = Debug
    WithoutCategories = IgnoreForCI
    BuildAllProjects = true
    InputOSGroup = Windows_NT
D:\j\workspace\windows_nt_de---0cbbd14c\src\System.Runtime\src\System.Runtime.csproj -->
  Global Properties:
    ConfigurationGroup = Debug
    WithoutCategories = IgnoreForCI
    BuildAllProjects = true
    InputOSGroup = Windows_NT
D:\j\workspace\windows_nt_de---0cbbd14c\src\System.Runtime\ref\System.Runtime.csproj
  Global Properties:
    ConfigurationGroup = Debug
    WithoutCategories = IgnoreForCI
    BuildAllProjects = true
    InputOSGroup = Windows_NT


MSBUILD : error MSB4015: The build stopped unexpectedly because the "ReusableLogger" logger failed unexpectedly during shutdown.
System.Exception: 1 bin clashes were detected during the build.
   at Microsoft.DotNet.Build.Tasks.BinClashLogger.Shutdown()
   at Microsoft.Build.Evaluation.ProjectCollection.ReusableLogger.Shutdown()
   at Microsoft.Build.BackEnd.Logging.LoggingService.ShutdownLogger(ILogger logger)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well to be correct it will be netstandard1.7 after @joperezr merge but as is I think it should be netstandard1.5

@joperezr joperezr self-assigned this Jul 29, 2016
@joperezr
Copy link
Member

Assigning this to me as I will be finishing up this work.

@joperezr
Copy link
Member

joperezr commented Aug 9, 2016

Closing, since #10667 replaces this.

@joperezr joperezr closed this Aug 9, 2016
@stephentoub stephentoub deleted the move_serialization_primitives branch September 7, 2016 16:50
@karelz karelz modified the milestone: 1.2.0 Dec 3, 2016
zacharycmontoya pushed a commit to dotnet/core-setup that referenced this pull request Mar 1, 2017
Update UWP metapackage for servicing by updating S.R.Serialization.Json, S.R.Serialization.Xml, and additional packages listed in dotnet/corefx#10388.
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.

6 participants