Closed
Description
While working on #38162 I observed behavior (that I believe is incorrect) when running with .NET 6 SDK RC1.
To reproduce the issue build and run the project using the following sequence of commands:
dotnet build -c Release
set COMPlus_EnableHWIntrinsic=0
dotnet run -c Release
Runtime_60035.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
</Project>
Runtime_60035.cs
using System;
using System.Text;
using System.Text.Encodings.Web;
namespace Runtime_60035
{
class Program
{
static void Main(string[] args)
{
byte[] inputBytes = Encoding.UTF8.GetBytes("https://github.com/dotnet/runtime");
Console.WriteLine(UrlEncoder.Default.FindFirstCharacterToEncodeUtf8(inputBytes));
}
}
}
The result will be a failure with the following stack trace
Unhandled exception. System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Runtime.Intrinsics.X86.Sse2.LoadVector128(Byte* address)
at System.Text.Encodings.Web.OptimizedInboxTextEncoder.GetIndexOfFirstByteToEncodeSsse3(Byte* pData, UIntPtr lengthInBytes)
at System.Text.Encodings.Web.OptimizedInboxTextEncoder.GetIndexOfFirstByteToEncode(ReadOnlySpan`1 data)
at System.Text.Encodings.Web.DefaultUrlEncoder.FindFirstCharacterToEncodeUtf8(ReadOnlySpan`1 utf8Text)
at Runtime_60035.Program.Main(String[] args) in D:\echesako\GitHub\Runtime_60035\Program.cs:line 12
If in addition to setting COMPlus_EnableHWIntrinsic=0
I set COMPlus_ReadyToRun=0
the issue goes away.