Closed
Description
Description
Run with LLVM on an arm64 device, and you can run into:
07-22 09:59:55.062 4374 4374 F mono-rt : [ERROR] FATAL UNHANDLED EXCEPTION: System.PlatformNotSupportedException: Arg_PlatformNotSupported
07-22 09:59:55.062 4374 4374 F mono-rt : at System.Text.ASCIIUtility.GetIndexOfFirstNonAsciiByte_Intrinsified(Byte* , UIntPtr )
07-22 09:59:55.062 4374 4374 F mono-rt : at System.Text.Unicode.Utf8Utility.GetPointerToFirstInvalidByte(Byte* , Int32 , Int32& , Int32& )
07-22 09:59:55.062 4374 4374 F mono-rt : at System.Text.UTF8Encoding.GetCharCount(Byte* , Int32 )
07-22 09:59:55.062 4374 4374 F mono-rt : at System.String.CreateStringFromEncoding(Byte* , Int32 , Encoding )
07-22 09:59:55.062 4374 4374 F mono-rt : at System.Text.Encoding.GetString(Byte* , Int32 )
07-22 09:59:55.062 4374 4374 F mono-rt : at System.String.CreateStringForSByteConstructor(Byte* , Int32 )
07-22 09:59:55.062 4374 4374 F mono-rt : at System.String.Ctor(SByte* value)
07-22 09:59:55.062 4374 4374 F mono-rt : at Java.Interop.TypeManager.GetClassName(IntPtr )
07-22 09:59:55.062 4374 4374 F mono-rt : at Android.Runtime.JNIEnv.RegisterJniNatives(IntPtr , Int32 , IntPtr , IntPtr , Int32 )
Somewhere here:
So I think AdvSimd.Arm64.IsSupported
is true
, but because GetIndexOfFirstNonAsciiByte_Intrinsified()
is not in the AOT profile (it's running under JIT), we get the above exception. It's possible that the above code should also work under JIT.
/cc @fanyang-mono
Reproduction Steps
dotnet new android
dotnet build -t:Run -c Release -p:EnableLLVM=true
to run on an arm64 device (in my case a Pixel 5)
Expected behavior
You can use Profiled AOT + LLVM together on Android.
Actual behavior
We get an exception when trying to use Profiled AOT + LLVM together on Android.
Regression?
I don't hit this same exception in .NET 6, but maybe it's just luck?
Known Workarounds
You can turn off profiled AOT, such as -p:AndroidEnableProfiledAot=false
or don't use LLVM.
Configuration
.NET 7.0.100-rc.1.22374.1
Other information
No response