-
Notifications
You must be signed in to change notification settings - Fork 5
Except for FormatterCache<Guid>, FormatterCache throws an exception in other situations #12
Copy link
Copy link
Closed
Description
I use MagicOnion with MagicOnion.Server.Redis.
this code works.
IMulticastSyncGroup<string, IUserHubReceiver> _group
= groupProvider.GetOrAddSynchronousGroup<Guid, IUserHubReceiver>(name);
...
_group.Single(guid).OnMessage();this code not works.
IMulticastSyncGroup<string, IUserHubReceiver> _group
= groupProvider.GetOrAddSynchronousGroup<string, IUserHubReceiver>(name);
...
_group.Single("test").OnMessage();stacktrace
Unhandled exception: Grpc.Core.RpcException: An error occurred while processing handler 'IUserHub/SendMessageAsync'.
System.TypeInitializationException: The type initializer for 'FormatterCache`1' threw an exception.
---> System.NotSupportedException: Specified method is not supported.
at Cysharp.Runtime.Multicast.Distributed.Redis.KeyArrayFormatter`1.FormatterCache`1..cctor()
--- End of inner exception stack trace ---
at Cysharp.Runtime.Multicast.Distributed.Redis.KeyArrayFormatter`1.FormatterCache`1.get_Instance()
at Cysharp.Runtime.Multicast.Distributed.Redis.RedisGroup`2.RedisPublishWriter.Write(ReadOnlyMemory`1 payload)
at Cysharp.Runtime.Multicast.Remoting.RemoteProxyBase.Invoke[T1](String name, Int32 methodId, T1 arg1)
at Wallaby_Shared_Hubs_IUserHubReceiver_Proxy.OnMessage(String)
at Wallaby.Web.Hubs.UserGroupService.Send(String id, String message) in C:\dinkum-root\outback-wallaby\src\Wallaby.Web\Hubs\UserGroupService.cs:line 14
at Wallaby.Web.Hubs.UserHub.SendMessageAsync(String message) in C:\dinkum-root\outback-wallaby\src\Wallaby.Web\Hubs\UserHub.cs:line 45
static FormatterCache()
{
if (typeof(T) == typeof(Guid))
{
Instance = (IMessagePackFormatter<T>)(object)NativeGuidFormatter.Instance;
return;
}
else
{
// TODO: Options
Instance = (IMessagePackFormatter<T>)(object)(MessagePackSerializerOptions.Standard.Resolver.GetFormatter<T>() ?? throw new NotSupportedException());
}
throw new NotSupportedException(); // except GUID, reach here <----
}Only GUID is allowed in FormatterCache.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels