CommunityToolkit / CommunityToolkit/dotnet

.NET 8 source-broke ROSExtensions.Count<>

Open
#796 1 comment 0 reactions 0 assignees View on GitHub
bug :bug:
Dominant language
C#
Stars
3.8k
Forks
400
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

Error
> CS0121 The call is ambiguous between the following methods or properties: 'System.MemoryExtensions.Count(System.ReadOnlySpan, T)' and 'CommunityToolkit.HighPerformance.ReadOnlySpanExtensions.Count(System.ReadOnlySpan, 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:
```cs
using CommunityToolkit.HighPerformance;
_ = default(ReadOnlySpan).Count((byte)0);
```
4. `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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.