Android java client - RuntimeException: Invocation provides 1 argument(s) but target expects 0.
alexandersokol opened this issue · comments
Alexander Sokol commented
Describe the bug
When Android Java client receives a message, signalR library rises internal exception during parsing that causes the whole client to fail. For other clients on front-end and iOS app it works well without any errors. I tried newer versions of the library but it doesn't have any effect.
Raw message received:
{"type":1,"target":"ReceiveVisibilityStatus","arguments":[{"userId":96411,"callStatus":1}]}
Mapping object:
data class VisibilityStatus(val userId: Long, val callStatus: Int)
Subscription:
hubConnection.on("ReceiveVisibilityStatus", {
Timber.i("Visibility status changed: ${it.userId} ${it.callStatus}")
}, VisibilityStatus::class.java)
To Reproduce
Client receives a message like:
{"type":1,"target":"ReceiveVisibilityStatus","arguments":[{"userId":96411,"callStatus":1}]}
Exceptions (if any)
Failed to bind arguments received in invocation 'null' of 'ReceiveVisibilityStatus'.
java.lang.RuntimeException: Invocation provides 1 argument(s) but target expects 0.
at com.microsoft.signalr.GsonHubProtocol.bindArguments(GsonHubProtocol.java:234)
at com.microsoft.signalr.GsonHubProtocol.parseMessages(GsonHubProtocol.java:108)
at com.microsoft.signalr.HubConnection.ReceiveLoop(HubConnection.java:469)
at com.microsoft.signalr.HubConnection.lambda$new$0$com-microsoft-signalr-HubConnection(HubConnection.java:168)
at com.microsoft.signalr.HubConnection$$ExternalSyntheticLambda47.invoke(Unknown Source:2)
at com.microsoft.signalr.WebSocketTransport.onReceive(WebSocketTransport.java:75)
at com.microsoft.signalr.WebSocketTransport.lambda$start$0$com-microsoft-signalr-WebSocketTransport(WebSocketTransport.java:52)
at com.microsoft.signalr.WebSocketTransport$$ExternalSyntheticLambda0.invoke(Unknown Source:2)
at com.microsoft.signalr.OkHttpWebSocketWrapper$SignalRWebSocketListener.onMessage(OkHttpWebSocketWrapper.java:95)
at okhttp3.internal.ws.RealWebSocket.onReadMessage(RealWebSocket.kt:333)
at okhttp3.internal.ws.WebSocketReader.readMessageFrame(WebSocketReader.kt:245)
at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.kt:106)
at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.kt:293)
at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:195)
at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
at java.lang.Thread.run(Thread.java:1012)
Further technical details
Back-end:
- Microsoft.AspNetCore.SignalR (1.0.1)
- Microsoft.AspNetCore.SignalR.Common (3.1.3)
- Microsoft.AspNetCore.SignalR.Core (1.0.1)
- Microsoft.AspNetCore.SignalR.Protocols.Json (1.1.0)
- Microsoft.AspNetCore.SignalR.StackExchangeRedis (3.1.3)
Android:
- com.microsoft.signalr:signalr:3.1.31 (also tested on 5.x, 6.x, 7.x, 8.x-preview with the same result)