platform-compat
platform-compat copied to clipboard
(ReadOnly)Span Slice isn't supported on Linux, macOS, and Windows
Using the analyser with the new Span classes from System.Memory on .NET Core 2.1 and I'm getting warnings that the Slice method is not supported, yet the program does run. Steps to reproduce:
dotnet new console
dotnet add package System.Memory --version 4.5.1
dotnet add package Microsoft.DotNet.Analyzers.Compatibility --version 0.2.12-alpha
Modify Program.cs to be:
using System;
class Program
{
static void Main(string[] args)
{
ReadOnlySpan<char> greeting = "Hello World".AsSpan().Slice(0, 5);
Console.WriteLine(greeting.ToString());
}
}
When running dotnet run on dotnet core 2.1.301 on Windows I get this output:
Program.cs(9,66): warning PC001: ReadOnlySpan<T>.Slice(int, int) isn't supported on Linux, macOS, and Windows [...]
Hello
I haven't tested on the other OS's, but the message states Windows is not supported yet it does work.
This was surprising.
Given that Span is a big part of the changes in core flagging it as a compat problem is very noisy. this could really do with fixing.
Is there any hope of getting this fixed?
#125 clearly is a dupe, but is not closed for >1 year now. Meanwhile, #135 is offering a fix, but no maintainer looked at it. Is this repository not maintained anymore?