This repository was archived by the owner on Dec 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 447
This repository was archived by the owner on Dec 18, 2018. It is now read-only.
"InvalidDataException: Error binding arguments" after switching to MessagePackProtocol from Json #2937
Copy link
Copy link
Closed
Description
Hi,
using Json as hubprotocol everything works correctly but switching to MessagePack Protocol causing binding error.
Chrome Console:
Error: Error: Failed to invoke 'SendImageToTeamWall' due to an error on the server. InvalidDataException: Error binding arguments. Make sure that the types of the provided values match the types of the hub method being invoked.
Visual studio output:
App.Web> ===> [09:59:10.323] [Error] Failed to invoke hub method '"SendImageToTeamWall"'.
App.Web> System.IO.InvalidDataException: Error binding arguments. Make sure that the types of the provided values match the types of the hub method being invoked. ---> System.IO.InvalidDataException: Deserializing object of the `String` type for 'argument' failed. ---> System.InvalidOperationException: code is invalid. code:3 format:positive fixint
App.Web> at MessagePack.Decoders.InvalidString.Read(Byte[] bytes, Int32 offset, Int32& readSize)
App.Web> at MessagePack.MessagePackSerializer.Deserialize[T](ArraySegment`1 bytes, IFormatterResolver resolver)
App.Web> at lambda_method(Closure , ArraySegment`1 , IFormatterResolver )
App.Web> at MessagePack.MessagePackSerializer.NonGeneric.Deserialize(Type type, ArraySegment`1 bytes, IFormatterResolver resolver)
App.Web> at Microsoft.AspNetCore.SignalR.Protocol.MessagePackHubProtocol.DeserializeObject(Byte[] input, Int32& offset, Type type, String field, IFormatterResolver resolver)
App.Web> --- End of inner exception stack trace ---
App.Web> at Microsoft.AspNetCore.SignalR.Protocol.MessagePackHubProtocol.DeserializeObject(Byte[] input, Int32& offset, Type type, String field, IFormatterResolver resolver)
App.Web> at Microsoft.AspNetCore.SignalR.Protocol.MessagePackHubProtocol.BindArguments(Byte[] input, Int32& offset, IReadOnlyList`1 parameterTypes, IFormatterResolver resolver)
App.Web> --- End of inner exception stack trace ---
App.Web> at Microsoft.AspNetCore.SignalR.Protocol.MessagePackHubProtocol.BindArguments(Byte[] input, Int32& offset, IReadOnlyList`1 parameterTypes, IFormatterResolver resolver)
App.Web> at Microsoft.AspNetCore.SignalR.Protocol.MessagePackHubProtocol.CreateInvocationMessage(Byte[] input, Int32& offset, IInvocationBinder binder, IFormatterResolver resolver)
server:
public Task SendImageToTeamWall(string wallId, string teamId, string fromUserId, string imageAsBase64)
client:
this._hubConnection
.invoke(
'SendImageToTeamWall',
this.getGroupName(team.teamWall),
team.id,
user.id,
imageAsBase64
)
.catch(err => {
console.error('ChathubService; SendImageToTeamWall Error:', err);
});
});
startup:
services.AddSignalR(o => { o.EnableDetailedErrors = true; })
.AddMessagePackProtocol(options =>
{
options.FormatterResolvers = new List<MessagePack.IFormatterResolver>()
{
MessagePack.Resolvers.StandardResolver.Instance
};
});
https://docs.microsoft.com/en-us/aspnet/core/signalr/messagepackhubprotocol?view=aspnetcore-2.1
Thanks
Metadata
Metadata
Assignees
Labels
No labels