CommunityToolkit / CommunityToolkit/dotnet

Overload resolution picks Toolkit's `Span<T>` extensions over BCL in .NET 10

Open
#1,138 0 comments 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

The BCL has included ORPA for its `Span` overloads in the `MemoryExtensions`, causing it to have lower priority than the Toolkit's overload.

### Regression

Yes, from .NET 9.

### Steps to reproduce

```csharp
#:package CommunityToolkit.HighPerformance@8.4.0
// #:property TargetFramework=net10.0
#:property TargetFramework=net9.0

using CommunityToolkit.HighPerformance;

Span test = [5, 4, 3, 2, 1, 0];

// 5 on .NET 9
// -1 on .NET 10
Console.WriteLine(test.IndexOf(0));
```

### Expected behavior

The BCL's `MemoryExtensions` is picked.

### Screenshots

_No response_

### IDE and version

Other

### IDE version

_No response_

### Nuget packages

- [ ] CommunityToolkit.Common
- [ ] CommunityToolkit.Diagnostics
- [x] CommunityToolkit.HighPerformance
- [ ] CommunityToolkit.Mvvm (aka MVVM Toolkit)

### Nuget package version(s)

8.4.0

### 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.