Skip to content

System.Text.Json defines netcoreapp3.0 with no dependencies #45560

Closed

Description

@BrennanConroy

Users are hitting an issue with needing to add an explicit reference to System.Text.Encodings.Web when they have System.Text.Json 5.0.0 in a netcoreapp3.1 project. I'm not sure why there is even a netcoreapp3.0 target for this package, but that's not my concern.

Looks like the regression was added between preview8 and rc1 of the 5.0.0 package.

image

Activity

  1. added
    untriaged
    on Dec 3, 2020
  2. BrennanConroy commented on Dec 7, 2020

    @BrennanConroy
    MemberAuthor

    @ericstj Could someone look into this as a possible 5.0.2 fix?

  3. ericstj commented on Dec 7, 2020

    @ericstj
    Member

    This is because the build of System.Text.Json for netcoreapp3.0 doesn't have a reference to the "live" built System.Text.Encoding.Web, instead it references the version from the shared framework. This creates a compatibility problem because the netstandard2.0 version references a higher version of the dependency than is inbox on netcoreapp3.0

    I believe this was caused by 809a06f. Previously the ref path build process would ensure that all libraries built would build against the live version of live built dependencies.

    This is similar to #40208.

    cc @ViktorHofer

    We should review all packages to see if there are other places where this change introduced such regressions.

  4. removed
    untriaged
    on Dec 7, 2020
  5. added this to the 5.0.x milestone on Dec 7, 2020
  6. self-assigned this
    on Dec 7, 2020
  7. ViktorHofer commented on Dec 7, 2020

    @ViktorHofer
    Member

    Ufff. @ericstj suggestions how to protect this locally/CI to avoid future regressions?

  8. ericstj commented on Dec 8, 2020

    @ericstj
    Member

    We don't have a great place today to test consistency of dependencies between two different compatible TFMs. @Anipik perhaps we can capture this in our list of things to validate packages for?

  9. ViktorHofer commented on Dec 8, 2020

    @ViktorHofer
    Member

    Can you please elaborate on "consistency of dependencies between two different compatible TFMs."?

  10. ericstj commented on Dec 8, 2020

    @ericstj
    Member

    Nothing compares the dependencies referenced by a package when that package is resolved for 2 different compatible TFMs. That's the sort of testing that would need to happen here to catch this bug.

    The problem is that this package, when resolved for netstandard2.0 exposes a System.Text.Encodings.Web version 5.0.0.0 assembly, but when resolved for netcoreapp3.0 it only exposes a 4.0.4.0 assembly. To catch this type of problem we'd need to evaluate restoring the packages and examining all sets of assemblies in the closure for compatibility between two different TFMs. One shortcut for this might be two compare the packages referenced (eg find that STEW 5.0.0.0 was referenced for netstandard2.0 but not for netcoreapp3.0), however we often intentionally trim package references when the assembly referenced is also inbox and we have consumers (EG: SDK) who depend on us doing this.

  11. ericstj commented on Dec 8, 2020

    @ericstj
    Member

    @ViktorHofer do you have ideas for how to scan for other instances of this issue?

    One thought I had was we could insist on a ProjectReference on non NetCoreAppCurrent frameworks if a project+package exists (suppressable). What do you think?

  12. ViktorHofer commented on Dec 8, 2020

    @ViktorHofer
    Member

    Yeah already at it. I had to finish the infrastructure rollout notification first which was higher prio. I'm currently looking at any projects that contain configurations older than $(NetCoreAppCurrent) which contain a pkgproj in its leaf. Filtering this further to just projects with P2Ps makes sense. Thanks for the suggestion.

  13. ghost added
    in-pr
    on Feb 11, 2021
  14. added
    Servicing-consider
    on Feb 11, 2021
  15. ghost removed
    in-pr
    on Feb 16, 2021
  16. ViktorHofer commented on Feb 16, 2021

    @ViktorHofer
    Member

    Reopening to track backporting into release/5.0.

  17. ghost added
    in-pr
    on Feb 16, 2021
  18. removed
    Servicing-consider
    on Feb 16, 2021
  19. ghost removed
    in-pr
    on Mar 13, 2021
  20. BrennanConroy commented on Mar 22, 2021

    @BrennanConroy
    MemberAuthor

    I know there has been work in this area, is there still some work left?

  21. ViktorHofer commented on Mar 23, 2021

    @ViktorHofer
    Member

    No, just forgot to close. Thanks.

  22. ghost locked as resolved and limited conversation to collaborators on Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions