dotnet / dotnet/aspnetcore

SignalR client: RPCs are not invoked on Android client if LLVM is on

Open
#33,493 13 comments 0 reactions 0 assignees View on GitHub
area-signalr linker-friendliness
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Describe the bug

My project is a Xamarin.Forms iOS/Android app. My project's shared project is a normal platform independent Xamarin.Forms .NET Standard 2.1 project. Said project is referencing the Microsoft.AspNetCore.SignalR.Client library.

There are several RPC registered to a HubConnection:
```c#
connection.On("SomeRPC", () =>
{
Console.WriteLine("HELLO!");
});
```

These work flawlessly in all permutations of release configurations except one.

iOS: AOT + LLVM: Works -- RPCs are invoked (i.e. `connection.On` callbacks are invoked).
Android: AOT: Works -- RPCs are invoked (i.e. `connection.On` callbacks are invoked).
Android AOT + LLVM: **Doesn't work!** RPCs are never invoked.

### To Reproduce

1) Set up a Xamarin.Forms application.
2) Add the Microsoft.AspNetCore.SignalR.Client NuGet to the shared project. Note: Use 6.0.0-preview1 because of this issue: https://github.com/dotnet/aspnetcore/issues/33269
3) Register some `connection.On` RPCs.
4) Use some means to invoke the RPCs (from some test server I guess).
5) *Optional*: Build and run a release build for iOS with AOT + LLVM on to verify that the RPCs are invoked.
6) *Optional*: Build and run a release build for Android with AOT on to verify that the RPCs are invoked.
7) Build and run a release build for Android with AOT + LLVM on to verify that the RPCs are **not** invoked.

(In the off-chance that Android LLVM builds fail to build, follow the workaround at https://github.com/xamarin/xamarin-android/issues/5764#issuecomment-856062396 until https://github.com/xamarin/xamarin-android/issues/5764 is fixed.)

_So all in all, turning LLVM on for Android builds makes RPCs not being called anymore. This effectively prevents one from using LLVM on Android until this issue is fixed._

### Exceptions (if any)

None. Breakpoints show that the RPCs are not invoked on Android when LLVM is turned on, but there are no exceptions.

### Further technical details
- Microsoft.AspNetCore.SignalR.Client version: 6.0.0-preview1
- Xamarin.Forms version: 5.0.0-2012
- VS For Mac version: 8.10.1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.