Comments (4)
This issue is about MemoryPack.
MemoryLayout compatibility can be a complicated case when not everything is Sequential.
For example, .NET 6/7 compatibility had the following problems
Cysharp/MemoryPack#107 (comment)
As far as I can see, everything is handled as Auto in Unity and Sequential in .
In this case, A is described as SequentialLayout and ValueTuple as AutoLayout, but in .NET 6 and below, the case seems to be similar to the problem in the comment above, where it does not do as specified.
The best thing to do is to not use ValueTuple (make them all Sequential), but as a workaround, making A an AutoLayout may solve the problem.
from magiconion.
Thank you.
With this sample, it is indeed a MemoryPack issue.
I am sorry for the confusion I caused by explaining it with ValueTuple,
The same issue is happening with MagicOnion.DynamicArgumentTuple.
DynamicArgumentTuple<A, int>(new A { B = 1, C = 2 }, -1);
in .Net, the memory placed by AutoLayout seems to place primitive types first.
I have confirmed that the problem of reversed memory layout order can be avoided by setting DynamicArgumentTuple to Sequential.
from magiconion.
This code can reproduce the problem with MagicOnion.
Common
[MemoryPackable]
[StructLayout(LayoutKind.Auto)]
// This also occurs when TestStruct is set to Sequential.
public partial struct TestStruct
{
public int A;
public int B;
}
public interface ITestService : IService<ITestService>
{
public UnaryResult SendTest(TestStruct ab, int c, int d);
}
Client (Unity)
var testService = MagicOnionClient.Create<ITestService>(channel);
await testService.SendTest(new TestStruct()
{
A = 1,
B = 2,
}, c: 3, d: 4);
Server (.Net)
public UnaryResult SendTest(TestStruct ab, int c, int d)
{
Console.WriteLine($"A={ab.A}");
Console.WriteLine($"B={ab.B}");
Console.WriteLine($"C={c}");
Console.WriteLine($"D={d}");
return UnaryResult.CompletedResult;
}
Result
A=3
B=4
C=1
D=2
from magiconion.
Resubmit issue in MemoryPack.
Cysharp/MemoryPack#191
from magiconion.
Related Issues (20)
- Failed to connect using Docker HOT 5
- ClientFilter for Streaming Hubs
- Will this work for WebGL applications? HOT 3
- Serialize DynamicArgumentTuple<int, int, int> exception in MagicOnion + MemoryPack HOT 2
- Upgrade Grpc.Net.Client in MagicOnion.Client
- MagicOnion.Generated.cs fails to compile in unity HOT 6
- StreamingHubClientBase exception handling error HOT 1
- Unhandleable exceptions when connecting HOT 1
- Question: any thoughts on reliable UDP or QUIC? And QoS? HOT 2
- Question: How can I connect the TLS protocol to the new version (v5.1.8)? HOT 1
- Question: Possible to use Task and ValueTask instead of UnaryResult and such? HOT 1
- Question: ObjectDisposedException on proxy side
- Question: Is a MagicOnion server possible from within Unity?
- can support Webgl http2 and net8?
- I can't have multiple implementations!
- .NET 8 Support
- Client filter is not triggered for ServerStreamingResult method in services. HOT 1
- Performance is very slow, taking 355ms for the Add function to return the result HOT 2
- How can I disconnect a client by server?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from magiconion.