SignalR client: RPCs are not invoked on Android client if LLVM is on
See original GitHub issueDescribe 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:
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
- Set up a Xamarin.Forms application.
- 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
- Register some
connection.On
RPCs. - Use some means to invoke the RPCs (from some test server I guess).
- Optional: Build and run a release build for iOS with AOT + LLVM on to verify that the RPCs are invoked.
- Optional: Build and run a release build for Android with AOT on to verify that the RPCs are invoked.
- 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
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (6 by maintainers)
SignalR doesn’t support linking in any form. We want to, we just have never done so. I’ve mentioned this several times. This includes AOT compiled Xamarin platforms that perform or Unity without work on the user’s end part. Many people have gotten SignalR to work on these platforms but
We’ll gladly fix issues identified by passionate members such as yourself who report them and help us support the existing platforms. Beyond that, we have no plans to do anything here in the short term.
We’ve moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.