Skip to content

iOS: "MONO interpreter: NIY encountered in method ReadTestCase_DataFromJson" when deserializing class with 200 fields #100753

@rolfbjarne

Description

@rolfbjarne

Description

App crashes with:

MONO interpreter: NIY encountered in method ReadTestCase_DataFromJson
error: * Assertion: should not be reached at /Users/runner/work/1/s/src/mono/mono/mini/interp/interp.c:3850

Reproduction Steps

Test case:
ios-plain-05465ea.zip

Run on iOS device.

Expected behavior

No crash.

Actual behavior

Crash with:

MONO interpreter: NIY encountered in method ReadTestCase_DataFromJson
error: * Assertion: should not be reached at /Users/runner/work/1/s/src/mono/mono/mini/interp/interp.c:3850

lldb stack trace:

(lldb) bt
* thread #1, name = 'tid_103', queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00000001c4fa6b38 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x00000001fed1b3bc libsystem_pthread.dylib`pthread_kill + 268
    frame #2: 0x00000001984b9524 libsystem_c.dylib`abort + 168
    frame #3: 0x00000001040f64e8 ios-plain`log_callback(log_domain=0x0000000000000000, log_level="error", message="* Assertion: should not be reached at /Users/runner/work/1/s/src/mono/mono/mini/interp/interp.c:3850\n", fatal=4, user_data=0x0000000000000000) at runtime.m:1180:3
    frame #4: 0x00000001042d42cc ios-plain`monoeg_g_logv_nofree [inlined] monoeg_g_logstr(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, msg=<unavailable>) at goutput.c:151:2 [opt]
    frame #5: 0x00000001042d42a0 ios-plain`monoeg_g_logv_nofree(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, format=<unavailable>, args=<unavailable>) at goutput.c:166:2 [opt]
    frame #6: 0x00000001042d433c ios-plain`monoeg_assertion_message(format=<unavailable>) at goutput.c:207:22 [opt]
    frame #7: 0x00000001042d4388 ios-plain`mono_assertion_message_unreachable(file=<unavailable>, line=<unavailable>) at goutput.c:234:2 [opt]
    frame #8: 0x0000000104421c40 ios-plain`mono_interp_exec_method(frame=0x000000016bd4f140, context=0x0000000283a00000, clause_args=<unavailable>) at interp.c:3850:4 [opt]
    frame #9: 0x000000010442012c ios-plain`interp_runtime_invoke(method=<unavailable>, obj=0x0000000000000000, params=0x000000016bd4f720, exc=<unavailable>, error=0x000000016bd4f780) at interp.c:2109:2 [opt]
    frame #10: 0x00000001043eedb0 ios-plain`mono_jit_runtime_invoke(method=0x0000000104c0fcf0, obj=<unavailable>, params=0x000000016bd4f720, exc=<unavailable>, error=0x000000016bd4f780) at mini-runtime.c:3672:12 [opt]
    frame #11: 0x0000000104396514 ios-plain`mono_runtime_invoke_checked [inlined] do_runtime_invoke(method=0x0000000104c0fcf0, obj=0x0000000000000000, params=0x000000016bd4f720, exc=0x0000000000000000, error=0x000000016bd4f780) at object.c:2576:11 [opt]
    frame #12: 0x00000001043964d8 ios-plain`mono_runtime_invoke_checked(method=0x0000000104c0fcf0, obj=0x0000000000000000, params=0x000000016bd4f720, error=0x000000016bd4f780) at object.c:2792:9 [opt]
    frame #13: 0x000000010439c810 ios-plain`mono_runtime_exec_main_checked [inlined] do_exec_main_checked(method=0x0000000104c0fcf0, args=<unavailable>, error=0x000000016bd4f780) at object.c:0 [opt]
    frame #14: 0x000000010439c7d4 ios-plain`mono_runtime_exec_main_checked(method=0x0000000104c0fcf0, args=<unavailable>, error=0x000000016bd4f780) at object.c:4775:9 [opt]
    frame #15: 0x00000001043f43b0 ios-plain`mono_jit_exec at driver.c:1369:13 [opt]
    frame #16: 0x00000001043f43a0 ios-plain`mono_jit_exec(domain=<unavailable>, assembly=<unavailable>, argc=1, argv=0x000000016bd4f800) at driver.c:1314:7 [opt]
    frame #17: 0x0000000104108f88 ios-plain`xamarin_main(argc=1, argv=0x000000016bd4fab8, launch_mode=XamarinLaunchModeApp) at monotouch-main.m:495:8
    frame #18: 0x000000010445c98c ios-plain`main(argc=1, argv=0x000000016bd4fab8) at main.arm64.mm:84:11
    frame #19: 0x0000000104b11da4 dyld`start + 520

Regression?

Yes, this works in .NET 7.

Known Workarounds

Use fewer fields.

Configuration

$ dotnet --info
.NET SDK:
 Version:           8.0.201
 Commit:            4c2d78f037
 Workload version:  8.0.200-manifests.a7f084b6

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  14.4
 OS Platform: Darwin
 RID:         osx-arm64
 Base Path:   /usr/local/share/dotnet/sdk/8.0.201/

.NET workloads installed:
 [macos]
   Installation Source: SDK 8.0.200
   Manifest Version:    14.2.8043/8.0.100
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.macos/14.2.8043/WorkloadManifest.json
   Install Type:        FileBased

 [maui-tizen]
   Installation Source: SDK 8.0.200
   Manifest Version:    8.0.7/8.0.100
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.maui/8.0.7/WorkloadManifest.json
   Install Type:        FileBased

 [ios]
   Installation Source: SDK 8.0.200
   Manifest Version:    17.2.8043/8.0.100
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.ios/17.2.8043/WorkloadManifest.json
   Install Type:        FileBased

 [maccatalyst]
   Installation Source: SDK 8.0.200
   Manifest Version:    17.2.8043/8.0.100
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.maccatalyst/17.2.8043/WorkloadManifest.json
   Install Type:        FileBased


Host:
  Version:      8.0.2
  Architecture: arm64
  Commit:       1381d5ebd2

.NET SDKs installed:
  7.0.311 [/usr/local/share/dotnet/sdk]
  8.0.100 [/usr/local/share/dotnet/sdk]
  8.0.201 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.14 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.14 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Other information

Reported in a DTS: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2018836

Looks like the assert was introduced in 23ddef3 by @kg

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions