We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It seems unmanaged struct always serialize all data as-is.
[MemoryPackable] public partial struct MyUnmanagedStruct { [MemoryPackIgnore] public int Value1; public int Value2; } public class MyTest { [Fact] public void IgnoredField_ShouldNotBeSerialized() { // Arrange var data = new MyUnmanagedStruct() { Value1 = 1, Value2 = 2 }; var bytes = MemoryPackSerializer.Serialize(data); // Act var deserialized = MemoryPackSerializer.Deserialize<MyUnmanagedStruct>(bytes); // Assert Assert.Equal(0, deserialized.Value1); // failed here Assert.Equal(data.Value2, deserialized.Value2); } }
The text was updated successfully, but these errors were encountered:
Yes, unmanaged structs ignore all configurations. It may be detected and changed to a compile error.
Sorry, something went wrong.
No branches or pull requests
It seems unmanaged struct always serialize all data as-is.
The text was updated successfully, but these errors were encountered: