Describe the bug
Two-dimensional spans like Span<T>.Empty.AsSpan2D(n, 0) and Span<T>.Empty.AsSpan2D(0, n) always have Height = 0 and Width = 0. This is caused by the special case https://github.com/CommunityToolkit/dotnet/blob/main/src/CommunityToolkit.HighPerformance/Memory/Span2D%7BT%7D.cs#L534.
Regression
No response
Steps to reproduce
// Examples of unexpected behavior:
Console.WriteLine(Span<bool>.Empty.AsSpan2D(1, 0).Height); // Prints 0.
Console.WriteLine(Span<bool>.Empty.AsSpan2D(0, 1).Width); // Prints 0.
// Examples of expected behavior:
Console.WriteLine(new bool[1, 0].AsSpan2D().Height); // Prints 1.
Console.WriteLine(new bool[0, 1].AsSpan2D().Width); // Prints 1.
Expected behavior
I expect Span<T>.Empty.AsSpan2D(n, 0) to have Height = n and Span<T>.Empty.AsSpan2D(0, n) to have Width = n. This is the behavior for two-dimensional arrays, i.e. new T[n, 0].AsSpan2D() and new T[0, n].AsSpan2D() have the correct widths and heights.
Screenshots
No response
IDE and version
Rider
IDE version
No response
Nuget packages
Nuget package version(s)
8.4.0
Additional context
No response
Help us help you
No, just wanted to report this
Describe the bug
Two-dimensional spans like
Span<T>.Empty.AsSpan2D(n, 0)andSpan<T>.Empty.AsSpan2D(0, n)always haveHeight = 0andWidth = 0. This is caused by the special case https://github.com/CommunityToolkit/dotnet/blob/main/src/CommunityToolkit.HighPerformance/Memory/Span2D%7BT%7D.cs#L534.Regression
No response
Steps to reproduce
Expected behavior
I expect
Span<T>.Empty.AsSpan2D(n, 0)to haveHeight = nandSpan<T>.Empty.AsSpan2D(0, n)to haveWidth = n. This is the behavior for two-dimensional arrays, i.e.new T[n, 0].AsSpan2D()andnew T[0, n].AsSpan2D()have the correct widths and heights.Screenshots
No response
IDE and version
Rider
IDE version
No response
Nuget packages
Nuget package version(s)
8.4.0
Additional context
No response
Help us help you
No, just wanted to report this