Skip to content

[mono][interp] "Arg storage type not yet supported" on specific P/Invoke method signature #82976

@frenzibyte

Description

@frenzibyte

Description

On an iOS project, with mono interpreter enabled, calling a P/Invoke method that has its 9th argument or upwards with a struct type that's larger than 16 bytes results in the following error:

2023-03-04 10:37:59.956 MonoInterpreterCrash1[1366:236450] error: Arg storage type not yet supported

Method signature:

	[DllImport(Constants.ObjectiveCLibrary, EntryPoint = "objc_msgSend")]
	private static extern void method(
		IntPtr a = default, // 1st argument, can be any type
		IntPtr b = default, // 2nd argument, can be any type
		IntPtr c = default, // 3rd argument, can be any type
		IntPtr d = default, // 4th argument, can be any type
		IntPtr e = default, // 5th argument, can be any type
		IntPtr f = default, // 6th argument, can be any type
		IntPtr g = default, // 7th argument, can be any type
		IntPtr h = default, // 8th argument, can be any type
		StructMoreThan16Bytes i = default); // 9th+ argument, struct type larger than 16 bytes

Reproduction Steps

  1. Clone test repo (https://github.com/frenzibyte/MonoInterpreterCrash1)
  2. Deploy MonoInterpreterCrash1 to physical device
  3. Run app

Expected behavior

Application runs successfully and displays "Called P/Invoke method successfully!" at the centre.

Actual behavior

Application crashes with the following:

2023-03-04 10:37:59.956 MonoInterpreterCrash1[1366:236450] error: Arg storage type not yet supported

=================================================================
	Native Crash Reporting
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
	Native stacktrace:
=================================================================
	0x102f2fbd0 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102f1ae88 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102f2f3b8 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x20db95a90 - /usr/lib/system/libsystem_platform.dylib : <redacted>
	0x20dc2f1ac - /usr/lib/system/libsystem_pthread.dylib : pthread_kill
	0x1c87e9ca0 - /usr/lib/system/libsystem_c.dylib : abort
	0x102ca0410 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : xamarin_find_protocol_wrapper_type
	0x102f6ab48 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102f6ac7c - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102f2b740 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102f3cba4 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102f32bc4 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102f31020 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102f03034 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102e4f610 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102e52ef4 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102f6fccc - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102f6f9c8 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x1c37e8f40 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x1c37e8664 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x1c37e7640 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x1c37e728c - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x1c352cd64 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : _UIScenePerformActionsWithLifecycleActionMask
	0x1c386ec3c - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x1c371f888 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x1c371f6b0 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x1c371f260 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x1c371f12c - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x1c3dfd5a0 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x1c3e9596c - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : _UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion
	0x1c35cb2d8 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x1c3a3d048 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x1c369dbec - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x1c369da5c - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x1c369cfb0 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x1c369cd3c - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x1d6c75d48 - /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices : <redacted>
	0x1d6cb5104 - /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices : <redacted>
	0x1d6c79ae4 - /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices : <redacted>
	0x1d6cb4d3c - /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices : <redacted>
	0x1c8785fdc - /usr/lib/system/libdispatch.dylib : <redacted>
	0x1c8789a5c - /usr/lib/system/libdispatch.dylib : <redacted>
	0x1d6c83f2c - /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices : <redacted>
	0x1d6c83ac8 - /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices : <redacted>
	0x1d6c862a8 - /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices : <redacted>
	0x1c13d622c - /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : <redacted>
	0x1c13e2614 - /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : <redacted>
	0x1c136657c - /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : <redacted>
	0x1c137beb8 - /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : <redacted>
	0x1c13811e4 - /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : CFRunLoopRunSpecific
	0x1fa1a1368 - /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices : GSEventRunModal
	0x1c3830d88 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x1c38309ec - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : UIApplicationMain
	0x102c9c1f4 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : xamarin_UIApplicationMain
	0x102f3d844 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102f3c9a4 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102f32ad8 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102f31020 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102f03034 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102e4f610 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102e55ed8 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102f07e18 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x102cb139c - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : xamarin_log
	0x102f6e6b4 - /private/var/containers/Bundle/Application/4E1BB8F5-2C4C-4A9A-A8C2-F40D575ABB86/MonoInterpreterCrash1.app/MonoInterpreterCrash1 : _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
	0x1df6a5948 - /usr/lib/dyld : <redacted>

=================================================================
	Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x1fd9f2200):0x1fd9f21f0  ff 0f 5f d6 c0 03 5f d6 10 29 80 d2 01 10 00 d4  .._..._..)......
0x1fd9f2200  03 01 00 54 7f 23 03 d5 fd 7b bf a9 fd 03 00 91  ...T.#...{......
0x1fd9f2210  8e ed ff 97 bf 03 00 91 fd 7b c1 a8 ff 0f 5f d6  .........{...._.
0x1fd9f2220  c0 03 5f d6 7f 23 03 d5 fd 7b bf a9 fd 03 00 91  .._..#...{......

=================================================================
	Managed Stacktrace:
=================================================================
	  at <unknown> <0xffffffff>
	  at UIKit.UIApplication:xamarin_UIApplicationMain <0x001cc>
	  at UIKit.UIApplication:UIApplicationMain <0x0002e>
	  at UIKit.UIApplication:Main <0x0011c>
	  at Program:<Main>$ <0x0001c>
	  at <Module>:runtime_invoke_direct_void_string[] <0x00076>
	  at <unknown> <0x00000>
=================================================================

Regression?

No response

Known Workarounds

Disabling Mono interpreter resolves the issue, but I need it enabled in the first place to work around #69410, realm/realm-dotnet#3100, and other JIT compilation exceptions in AutoMapper.

Configuration

  • Version: .NET 6.0.406
  • Platform: macOS 13.0.1
  • Architecture: ARM64 (M1)
  • Not specific to the configuration

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions