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 #1509DescriptionBug 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
ActivityAArnott commented on Oct 1, 2022 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. joshdean2000 commented on Oct 1, 2022 It's the packages it's referencing therefore including in the project. AArnott commented on Oct 2, 2022 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. github-actions commented on Jan 1, 2023 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. BrennanConroy commented on Jan 10, 2023 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. KalleOlaviNiemitalo commented on Jan 10, 2023 AArnott commented on Jan 11, 2023 This is a bug in Microsoft.NET.StringTools, as it introduces a colliding API with System.Memory. I filed dotnet/msbuild#8299. BrennanConroy commented on Jan 11, 2023 I already filed an issue, see my comment above :/ AArnott commented on Jan 11, 2023 I'll whip up a PR to workaround it in MessagePack, since there is no need to add the ref assembly to Net.StringTools. added a commit that references this issue on Jan 11, 2023This issue will close once commit 26135de is merged into the 'master' branch.26135de lbargaoanu commented on Jan 27, 2023 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'. AArnott commented on Jan 27, 2023 @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 lbargaoanu commented on Jan 27, 2023 Thanks! Yes, I was using the latest, 2.5.67. 2.4.66 works. fedemkr commented on May 10, 2023 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.* AArnott commented on May 19, 2023 @fedemkr v2.5.94 and later also has the fix.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|