Search Issue Tracker

Duplicate

Unknown (hidden) 2021.3.X, 2022.1.X, 2022.2.X, 2023.1.X

Votes

0

Found in

2021.3.12f1

2022.1.21f1

2022.2.0b13

2023.1.0a17

Issue ID

UUM-18556

Regression

No

SignalR HubConnectionBuilder fails when run in non-Windows IL2CPP builds

--

-

Reproduction steps:
1. Open the user’s attached project (“repro.zip“)
2. Open the “/Assets/ReproScene.unity” Scene
3. Make sure that IL2CPP is selected as the Scripting Backend in Player settings
4. Go to Window > Package Manager and add Android LogCat from Unity Registry
5. Go to Window > Analysis and open the Android LogCat window
6. Build And Run on an Android device
7. Observe the Android LogCat window

Expected result: No exceptions linked to Microsoft or SignalR are thrown in the LogCat when running the Player
Actual result: Exceptions linked to Microsoft or SignalR are shown in the LogCat

Reproducible with: 2021.3.12f1, 2022.1.21f1, 2022.2.0b13, 2023.1.0a17
Could not test with: 2020.3.41f1 (“ArgumentException: The Assembly System.Memory is referenced by System.IO.Pipelines ('Assets/Plugins/System.IO.Pipelines.dll'”)

Reproducible with devices:
VLNQA00318, Oneplus OnePlus 7 Pro (GM1913), Android 11, CPU: Snapdragon 855 SM8150, GPU: Adreno (TM) 640
VLNQA00231, Huawei HUAWEI Mate 20 Pro (LYA-L29), Android 9, CPU: HiSilicon Kirin 980, GPU: Mali-G76
VLNQA00332, Samsung Galaxy XCover4 (SM-G390F), Android 9, CPU: Exynos 7 Quad 7570, GPU: Mali-T720
VLNQA00325, Samsung Galaxy Note10 (SM-N970F), Android 12, CPU: NOT FOUND, GPU: Mali-G76
VLNQA00231, Samsung Galaxy A5(2017) (SM-A520F), Android 8.0.0, CPU: Exynos 7 Octa 7880, GPU: Mali-T830

Reproduced on: Windows 10 Enterprise 21H2

Notes:

* This works fine in Editor, Windows standalone builds (mono or il2cpp) and Android mono builds, but an exception is thrown in the Android il2cpp build

  1. Resolution Note:

    This is a duplicate of UUM-5771. Note that even with the fix for UUM-5771, this project still causes an exception. This exception happens because an assembly in the project depends on reflection, and some methods it needs are stripped out.

    Adding this link to the link.xml file works around the issue:

    <assembly fullname="Microsoft.AspNetCore.SignalR.Client.Core" preserve="all" />

    There are two static fields in the HubConnection class that depend on reflection to find methods:

    Unable to find source-code formatter for language: csharp. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
    private static readonly MethodInfo _sendStreamItemsMethod = typeof(HubConnection).GetMethods(BindingFlags.Instance | BindingFlags.NonPublic).Single((MethodInfo m) => m.Name.Equals("SendStreamItems"));
    private static readonly MethodInfo _sendIAsyncStreamItemsMethod = typeof(HubConnection).GetMethods(BindingFlags.Instance | BindingFlags.NonPublic).Single((MethodInfo m) => m.Name.Equals("SendIAsyncEnumerableStreamItems"));
    When those methods are stripped, this code will cause the InvalidOperationException exception.
    Duplicate of https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-5771

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.