I have a signalr application with the message pack protocol enabled. When the client connecting to my hub has message-pack enabled, everything works well, When I call a client (With message pack disabled) method passing as parameter an object containing a list of objects, Message pack fails throwing an exception with message:
can't find matched constructor. type:Newtonsoft.Json.Linq.JProperty
The stacktrace shows this exception was thrown via the Redis back-plane set up with signalr
Microsoft.AspNetCore.SignalR.Protocol.MessagePackHubProtocol.GetMessageBytes(HubMessage message) at Microsoft.AspNetCore.SignalR.SerializedHubMessage.GetSerializedMessage(IHubProtocol protocol) at Microsoft.AspNetCore.SignalR.Redis.Internal.RedisProtocol.WriteSerializedHubMessage(Stream stream, SerializedHubMessage message) at Microsoft.AspNetCore.SignalR.Redis.Internal.RedisProtocol.WriteInvocation(String methodName, Object[] args, IReadOnlyList
1 excludedConnectionIds) at Microsoft.AspNetCore.SignalR.Redis.RedisHubLifetimeManager
1.SendGroupExceptAsync(String groupName, String methodName, Object[] args, IReadOnlyList`1 excludedConnectionIds, CancellationToken cancellationToken)
Here is how I added Message pack and Redis with signalr:
services.AddSignalR((options) =>
{
options.MaximumReceiveMessageSize = 5242880;
options.EnableDetailedErrors = true;
})
.AddRedis(Configuration.GetConnectionString("RedisCache"))
.AddNewtonsoftJsonProtocol()
.AddMessagePackProtocol();
I have tried adding custom resolvers to message pack but couldn't resolve this Has anyone ever encountered this issue ? or does anyone have a solution ?