Using SignalR core with Unity and IL2CPP (AOT)
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
I am having a similar issue as #10080. I am using preview 6 of asp.net core SignalR client inside of unity and compiling with IL2CPP. [I created a small git repo with the code I use to reproduce this issue](https://github.com/thorgeirk11/SignalR-IL2CPP-failure-example )
I am running into an exception when starting the connection:
```cs
connection = new HubConnectionBuilder()
.WithUrl("http://localhost:5000/gamehub")
.Build(); // works fine
await connection.StartAsync(); // takes a few sec before failing
```
The `connection.StartAsync` fails with the following exception:
```
InvalidDataException: Missing required property 'connectionId'.
at Microsoft.AspNetCore.Http.Connections.NegotiateProtocol.ParseResponse (System.ReadOnlySpan`1[T] content)
```
Unity's IL2CPP strips unused assemblies. It caused another issue but I fixed that by adding [link.xml file](https://github.com/thorgeirk11/SignalR-IL2CPP-failure-example/blob/master/Unity%202018.4%20Client/Assets/link.xml). So the issue described here should not be affected by code stripping.
Here are the [server](https://github.com/thorgeirk11/SignalR-IL2CPP-failure-example/blob/master/server_output.log) and [client](https://github.com/thorgeirk11/SignalR-IL2CPP-failure-example/blob/master/client_output.log) traces.
Contributor guide
Research direction
Start with the linked reproduction repository, especially the Unity 2018.4 client, Assets/link.xml, server_output.log, and client_output.log. Reproduce the failure at HubConnection.StartAsync and inspect Microsoft.AspNetCore.Http.Connections.NegotiateProtocol.ParseResponse alongside the related issue #10080. Done means the IL2CPP client starts the SignalR connection without the missing connectionId exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, unity
- Domain
- backend-api-design, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100