Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SignalR error: Invocation provides 1 argument(s) but target expects 0

I am using signalR core with angular6 and I am receiving messages but in console I alwazs get this error.

What does it mean?

System.IO.InvalidDataException: Invocation provides 1 argument(s) but target expects 0.
   at Microsoft.AspNetCore.SignalR.Protocol.MessagePackHubProtocol.BindArguments(Byte[] input, Int32& offset, IReadOnlyList`1 parameterTypes, IFormatterResolver resolver)
   at Microsoft.AspNetCore.SignalR.Protocol.MessagePackHubProtocol.CreateInvocationMessage(Byte[] input, Int32& offset, IInvocationBinder binder, IFormatterResolver resolver)
fail: Microsoft.AspNetCore.SignalR.Client.HubConnection[57]
      Failed to bind arguments received in invocation '(null)' of 'Send'.
System.IO.InvalidDataException: Invocation provides 1 argument(s) but target expects 0.
   at Microsoft.AspNetCore.SignalR.Protocol.MessagePackHubProtocol.BindArguments(Byte[] input, Int32& offset, IReadOnlyList`1 parameterTypes, IFormatterResolver resolver)
   at Microsoft.AspNetCore.SignalR.Protocol.MessagePackHubProtocol.CreateInvocationMessage(Byte[] input, Int32& offset, IInvocationBinder binder, IFormatterResolver resolver)
warn: Microsoft.AspNetCore.SignalR.Client.HubConnection[14]
like image 846
senzacionale Avatar asked Oct 27 '25 10:10

senzacionale


1 Answers

I stumbled upon the same error; although my Hub in my C# code had the right number of parameters.

Turned out that the Hub my javascript script code was connected to was the wrong one.

i.e., this error can occur if your javascript client is connected to a server Hub that

  1. Has the method, but the number of arguments does not match or
  2. Does not have the method called by the javascript (Hint: Check for typos!)
like image 66
Xpleria Avatar answered Oct 29 '25 00:10

Xpleria