GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — .Net 4.6.2 projects no longer build · Issue #1509 · MessagePack-CSharp/MessagePack-CSharp

.Net 4.6.2 projects no longer build #1509

New issue
Copy link
New issue
Copy link
Closed
#1549
Closed
.Net 4.6.2 projects no longer build#1509
#1549
Copy link
Labels
invalidno-issue-activity

Description

@joshdean2000
joshdean2000
opened on Sep 30, 2022
Issue body actions

Bug description

Error CS0121 The call is ambiguous between the following methods or properties: 'System.MemoryExtensions.AsSpan(T[], int, int)' and 'System.MemoryExtensions.AsSpan(T[], int, int)'

Repro steps

Simply add the following line of code to any .Net 4.6.2 project.

ReadOnlySpan<byte> value = (new byte[100]).AsSpan(0, 10);
  • Version used: 2.4.35
  • Runtime: .Net 4.6.2

Activity

  1. AArnott commented on Oct 1, 2022

    @AArnott
    AArnott
    on Oct 1, 2022
    Collaborator
    More actions

    What does this have to do with MessagePack? It doesn't define this method. That's defined in System.Memory, which is a Microsoft package.

  2. joshdean2000 commented on Oct 1, 2022

    @joshdean2000
    joshdean2000
    on Oct 1, 2022
    Author
    More actions

    It's the packages it's referencing therefore including in the project.

  3. AArnott commented on Oct 2, 2022

    @AArnott
    AArnott
    on Oct 2, 2022
    Collaborator
    More actions

    Sure, that's a dependency, but if your project is referencing that assembly twice, that isn't anything MessagePack can help with. You should review your project file and maybe the build logs to find out where the second reference is coming from.

  4. github-actions commented on Jan 1, 2023

    @github-actions
    github-actionsBot
    on Jan 1, 2023
    Contributor
    More actions

    This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.

  5. github-actions
    added
    no-issue-activity
    on Jan 1, 2023
  6. AArnott
    added
    invalid
    on Jan 3, 2023
  7. AArnott
    closed this as not plannedon Jan 3, 2023
  8. BrennanConroy commented on Jan 10, 2023

    @BrennanConroy
    BrennanConroy
    on Jan 10, 2023
    More actions

    Looks like this is an issue with the Microsoft.NET.StringTool package and also referencing System.Memory in the same net462 project. dotnet/msbuild#8295
    And since MessagePack brings in both references (empty console app + MessagePack reference easily shows this), the MessagePack library is no longer usable in net462 apps.

  9. KalleOlaviNiemitalo commented on Jan 10, 2023

    @KalleOlaviNiemitalo
    KalleOlaviNiemitalo
    on Jan 10, 2023
    More actions

    Could this be fixed by changing MessagePack to use PrivateAssets="compile" in its Microsoft.NET.StringTools reference? https://github.com/neuecc/MessagePack-CSharp/blob/3bc35e3603004c79765746b110f76d0d29ead4eb/src/MessagePack/MessagePack.csproj#L37

  10. AArnott commented on Jan 11, 2023

    @AArnott
    AArnott
    on Jan 11, 2023
    Collaborator
    More actions

    This is a bug in Microsoft.NET.StringTools, as it introduces a colliding API with System.Memory. I filed dotnet/msbuild#8299.

  11. BrennanConroy commented on Jan 11, 2023

    @BrennanConroy
    BrennanConroy
    on Jan 11, 2023
    More actions

    I already filed an issue, see my comment above :/

    Reacted by Andrew Arnott
  12. AArnott commented on Jan 11, 2023

    @AArnott
    AArnott
    on Jan 11, 2023
    Collaborator
    More actions

    I'll whip up a PR to workaround it in MessagePack, since there is no need to add the ref assembly to Net.StringTools.

    Reacted by Brennan
  13. AArnott
    added a commit that references this issue on Jan 11, 2023

    Hide Microsoft.NET.StringTools from compilation of downstream projects

    This issue will close once commit 26135de is merged into the 'master' branch.
    26135de
  14. AArnott
    reopened this on Jan 11, 2023
  15. AArnott
    closed this as completedin #1549on Jan 11, 2023
  16. lbargaoanu commented on Jan 27, 2023

    @lbargaoanu
    lbargaoanu
    on Jan 27, 2023
    More actions

    I'm using the CI nuget package with MessagePack.MSBuild.Tasks and I get error CS0433: The type 'MemoryExtensions' exists in both 'Microsoft.NET.StringTools.net35, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

  17. AArnott commented on Jan 27, 2023

    @AArnott
    AArnott
    on Jan 27, 2023
    Collaborator
    More actions

    @lbargaoanu Which version of MessagePack.MSBuild.Tasks exactly are you using? You need exactly v2.4.66 (2.5 doesn't have the change yet).

    Reacted by Lucian Bargaoanu
  18. lbargaoanu commented on Jan 27, 2023

    @lbargaoanu
    lbargaoanu
    on Jan 27, 2023
    More actions

    Thanks! Yes, I was using the latest, 2.5.67. 2.4.66 works.

    Reacted by Andrew Arnott
  19. niemyjski
    added a commit that references this issue on Apr 11, 2023

    Bump MessagePack dep

    638b1a6
  20. fedemkr commented on May 10, 2023

    @fedemkr
    fedemkr
    on May 10, 2023
    More actions

    Hi there, we're having some trouble updating from 2.4.59 on a Xamarin application and it fails to compile in Android with this same error.
    The shared project is using .Net Standard 2.1 where the package is installed.
    We tried looking for the nugget version of 2.4.66 but couldn't find it, was that version renamed to another one or removed? I see it mentioned that it's not yet implemented in 2.5.*

  21. AArnott commented on May 19, 2023

    @AArnott
    AArnott
    on May 19, 2023
    Collaborator
    More actions

    @fedemkr v2.5.94 and later also has the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidno-issue-activity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.