From b53c4a2a8deaf89ee293b4fbe0ed95dbceecced4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 02:02:46 +0000 Subject: [PATCH] Marshal mono_ios_* string args as UTF-8 for NativeAOT (ILC) compatibility The Apple test harness p/invokes mono_ios_append_output/mono_ios_set_summary declared 'string value' with default (ANSI) DllImport marshalling. The ILC NativeAOT compiler rejects this with MarshalDirectiveException, breaking every work item on the tvos-arm64/ios AllSubsets_NativeAOT legs enabled by #125437. The native implementations take 'const char*' and call [NSString stringWithUTF8String:], so UTF-8 (LPUTF8Str) marshalling is the correct, ILC-supported directive. Refs #130219 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/libraries/Common/tests/AppleTestRunner/AppleTestRunner.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/Common/tests/AppleTestRunner/AppleTestRunner.cs b/src/libraries/Common/tests/AppleTestRunner/AppleTestRunner.cs index 2af27adacbe6d0..ab1c0ab9b28191 100644 --- a/src/libraries/Common/tests/AppleTestRunner/AppleTestRunner.cs +++ b/src/libraries/Common/tests/AppleTestRunner/AppleTestRunner.cs @@ -21,10 +21,10 @@ public class SimpleTestRunner : iOSApplicationEntryPoint, IDevice { // to be wired once https://github.com/dotnet/xharness/pull/46 is merged [DllImport("__Internal")] - public extern static void mono_ios_append_output (string value); + public extern static void mono_ios_append_output ([MarshalAs(UnmanagedType.LPUTF8Str)] string value); [DllImport("__Internal")] - public extern static void mono_ios_set_summary (string value); + public extern static void mono_ios_set_summary ([MarshalAs(UnmanagedType.LPUTF8Str)] string value); private static List s_testLibs = new List(); private static List? s_testAssemblies;