dotnet icon indicating copy to clipboard operation
dotnet copied to clipboard

.NET 8 source-broke ROSExtensions.Count<>

Open xparadoxical opened this issue 9 months ago • 1 comments

Describe the bug

Error

CS0121 The call is ambiguous between the following methods or properties: 'System.MemoryExtensions.Count<T>(System.ReadOnlySpan<T>, T)' and 'CommunityToolkit.HighPerformance.ReadOnlySpanExtensions.Count<T>(System.ReadOnlySpan<T>, T)'

after changing the TargetFramework to net8.0.

Regression

7.1.2, 8.2.2 - with .net 7

Steps to reproduce

  1. dotnet new console -f net8.0
  2. dotnet add package CommunityToolkit.HighPerformance
  3. Program.cs:
using CommunityToolkit.HighPerformance;
_ = default(ReadOnlySpan<byte>).Count((byte)0);
  1. dotnet build

Expected behavior

It should compile, just like with net7.0.

Screenshots

No response

IDE and version

VS 2022

IDE version

No response

Nuget packages

  • [ ] CommunityToolkit.Common
  • [ ] CommunityToolkit.Diagnostics
  • [X] CommunityToolkit.HighPerformance
  • [ ] CommunityToolkit.Mvvm (aka MVVM Toolkit)

Nuget package version(s)

8.2.2

Additional context

No response

Help us help you

No, just wanted to report this

xparadoxical avatar Nov 19 '23 02:11 xparadoxical

I've encountered this as well. I wonder if this API is needed in .NET 8+ anymore, and could be omitted from compile on that target altogether.

ovska avatar Nov 19 '23 18:11 ovska