Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialize DynamicArgumentTuple<int, int, int> exception in MagicOnion + MemoryPack #686

Closed
0x5143 opened this issue Oct 11, 2023 · 3 comments
Labels
stale stale not updated issue & pr

Comments

@0x5143
Copy link
Contributor

0x5143 commented Oct 11, 2023

Env: MagicOnion + MemoryPack
Ver: 5.1.8
Client: Unity 2021.3.12f1
Server: .NET 7.0 x64
Method:

Task Test3Async(int a, int b, int c);

Serialize exception:

fail: MagicOnion.Server.MethodHandler[91]
      A hub method handler throws an exception occurred in IChatHub/Test3Async
      MemoryPack.MemoryPackSerializationException: Sequence reached end, reader can not provide more buffer.
         at MemoryPack.MemoryPackSerializationException.ThrowSequenceReachedEnd()
         at MemoryPack.MemoryPackReader.GetNextSpan(Int32 sizeHint)
         at MemoryPack.Formatters.DangerousUnmanagedFormatter`1.Deserialize(MemoryPackReader& reader, T& value)
         at MemoryPack.MemoryPackSerializer.Deserialize[T](ReadOnlySequence`1& buffer, T& value, MemoryPackSerializerOptions options)
         at MemoryPack.MemoryPackSerializer.Deserialize[T](ReadOnlySequence`1& buffer, MemoryPackSerializerOptions options)
         at MagicOnion.Serialization.MemoryPack.MemoryPackMagicOnionSerializerProvider.MagicOnionSerializer.Deserialize[T](ReadOnlySequence`1& bytes) in E:\Projects\GitHub\MagicOnion\src\MagicOnion.Serialization.MemoryPack\MemoryPackMagicOnionSerializer.cs:line 45
         at MagicOnion.Serialization.MemoryPack.MemoryPackMagicOnionSerializerProvider.MagicOnionSerializer.MagicOnion.Serialization.IMagicOnionSerializer.Deserialize[T](ReadOnlySequence`1& bytes)
         at MagicOnion.Server.Hubs.StreamingHubMethodInvoker.StreamingHubMethodInvokerTask`1.InvokeAsync(StreamingHubContext context) in E:\Projects\GitHub\MagicOnion\src\MagicOnion.Server\Hubs\StreamingHubHandler.cs:line 157
         at MagicOnion.Server.Hubs.StreamingHubBase`2.HandleMessageAsync() in E:\Projects\GitHub\MagicOnion\src\MagicOnion.Server\Hubs\StreamingHub.cs:line 184

The following function works fine:

Task Test1Async(int a);
Task Test2Async(int a, int b);
@0x5143
Copy link
Contributor Author

0x5143 commented Oct 11, 2023

var abc1 = Unsafe.SizeOf<DynamicArgumentTuple<int, int>>();
var abc2 = Unsafe.SizeOf<DynamicArgumentTuple<int, int, int>>();
var abc3 = Unsafe.SizeOf<DynamicArgumentTuple<int, int, int, int>>();
var abc4 = Unsafe.SizeOf<DynamicArgumentTuple<int, int, int, int, int>>();
var abc5 = Unsafe.SizeOf<DynamicArgumentTuple<int, int, int, int, int, int>>();

Windows 10 x64 ASP.NET Result: 8, 16, 16, 24, 24
Unity 2021.3.12f1 Result: 8, 12, 16, 20, 24

@0x5143
Copy link
Contributor Author

0x5143 commented Nov 12, 2023

Modified ASP.NET .csproj will fixed this:

<PlatformTarget>x86</PlatformTarget>

Copy link
Contributor

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the stale stale not updated issue & pr label May 11, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale stale not updated issue & pr
Projects
None yet
Development

No branches or pull requests

1 participant