dotnet / dotnet/macios

aot-compiled net6-ios app fails retrieving property

Open
#15,961 7 comments 0 reactions 0 assignees View on GitHub
iOS
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 9h
Merged PRs (30d)
123

Description

### Steps to Reproduce

1. Build an ios app using the StreamJsonRPC library: https://github.com/microsoft/vs-streamjsonrpc
2. Send a JsonRPCMessage

```
Error in rpc communication: Newtonsoft.Json.JsonSerializationException: Error writing JSON RPC Message: JsonSerializationException: Error getting value from 'RequestId' on 'StreamJsonRpc.JsonMessageFormatter+OutboundJsonRpcRequest'.
---> Newtonsoft.Json.JsonSerializationException: Error getting value from 'RequestId' on 'StreamJsonRpc.JsonMessageFormatter+OutboundJsonRpcRequest'.
---> System.ExecutionEngineException: Attempting to JIT compile method '(wrapper delegate-invoke) StreamJsonRpc.RequestId :invoke_callvirt_RequestId_JsonRpcRequest (StreamJsonRpc.Protocol.JsonRpcRequest)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.

at System.Linq.Expressions.Interpreter.FuncCallInstruction`2[[StreamJsonRpc.Protocol.JsonRpcRequest, StreamJsonRpc, Version=2.12.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a],[StreamJsonRpc.RequestId, StreamJsonRpc, Version=2.12.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].<…>
```

### Expected Behavior
Retrieving the value of a simple property should not fail

### Actual Behavior
Retrieving `RequestId` property fails causing app to crash.

### Environment

Version information

```
Visual Studio Community 2022 for Mac Preview
Version 17.4 Preview (17.4 build 715)
Installation UUID: c32fa707-d708-44f7-9f40-ecd4b7f8aeb7

Runtime
.NET 6.0.5 (64-bit)
Architecture: Arm64

Roslyn (Language Service)
4.4.0-1.22371.1+c07f2571612b471671c809b5b0db59b0c37aab57

NuGet
Version: 6.2.1.2

.NET SDK (Arm64)
SDK: /usr/local/share/dotnet/sdk/6.0.400/Sdks
SDK Versions:
6.0.400
6.0.400-preview.22330.6
6.0.302
6.0.301
6.0.300
6.0.201
MSBuild SDKs: /Applications/Visual Studio (Preview).app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET SDK (x64)
SDK Versions:
6.0.400
6.0.400-preview.22330.6
6.0.302
6.0.301
6.0.300
6.0.201
6.0.105
6.0.103
5.0.408
5.0.407
5.0.406
4.1.422
3.1.421
3.1.420
3.1.419
3.1.418
3.1.417

.NET Runtime (Arm64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
6.0.8
6.0.7
6.0.6
6.0.5
6.0.3

.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/x64/dotnet
Runtime Versions:
6.0.8
6.0.7
6.0.6
6.0.5
6.0.3
5.0.17
5.0.16
5.0.15
3.1.28
3.1.27
3.1.26
3.1.25
3.1.24
3.1.23

Xamarin.Profiler
Version: 1.8.0.19
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Apple Developer Tools
Xcode 14.0 (21335)
Build 14A309

Xamarin.Mac
Version: 8.12.0.2 (Visual Studio Community)
Hash: 87f98a75e
Branch: d17-3
Build date: 2022-07-25 20:18:54-0400

Xamarin.iOS
Version: 15.12.0.2 (Visual Studio Community)
Hash: 87f98a75e
Branch: d17-3
Build date: 2022-07-25 20:18:55-0400

Xamarin Designer
Version: 17.4.0.32
Hash: 439b92ed7b
Branch: remotes/origin/d17-4
Build date: 2022-08-04 16:29:17 UTC

Xamarin.Android
Version: 13.0.99.36 (Visual Studio Community)
Commit: xamarin-android/main/b4998c8
Android SDK: /Users/manuel.moraga/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
12.0 (API level 31)
11.0 (API level 30)

SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 33.0.2
SDK Build Tools Version: 33.0.0

Build Information:
Mono: dffa5ab
Java.Interop: xamarin/java.interop/main@032f1e71
SQLite: xamarin/sqlite/3.39.2@40e8743
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@9c641b3

Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.14.1
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 17.4.0.24
Hash: b3b6672
Branch: remotes/origin/HEAD~1
Build date: 2022-08-04 16:29:21 UTC

Android Device Manager
Version: 0.0.0.1179
Hash: 0f220c0
Branch: main
Build date: 2022-08-04 16:29:21 UTC

Build Information
Release ID: 1704000715
Git revision: 09071dadfc1b81e4f0e2c9505cd8a5ef0b41d312
Build date: 2022-08-04 16:26:39+00
Build branch: release-17.4
Build lane: release-17.4

Operating System
Mac OS X 12.6.0
Darwin 21.6.0 Darwin Kernel Version 21.6.0
Mon Aug 22 20:19:52 PDT 2022
root:xnu-8020.140.49~2/RELEASE_ARM64_T6000 arm64

```

### Build Logs

[msbuild.binlog.zip](https://github.com/xamarin/xamarin-macios/files/9573902/msbuild.binlog.zip)

### Example Project (If Possible)

https://github.com/mmoraga/jsonrpc-repro

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked jsonrpc-repro example project and the reported stack trace around StreamJsonRpc.JsonMessageFormatter.OutboundJsonRpcRequest.RequestId. Reproduce the failure in an AOT-compiled net6-ios app, then use the msbuild binlog and the referenced StreamJsonRPC path to identify the relevant boundary. Done means sending a JsonRPCMessage retrieves RequestId without an ExecutionEngineException.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, ios
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.