-
Notifications
You must be signed in to change notification settings - Fork 62
bugfix not using know serializers when defined #184
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
Conversation
@Aaronontheweb @Arkatufus |
@jogibear9988 yessir, we will |
Yep, added @Arkatufus to this issue |
@jogibear9988 |
@jogibear9988 if you could help explain the issue more clearly in terms of "expected" vs. "actual" behavior, we would appreciate it. Can't merge this change without fully grasping what it was trying to solve and how this works. |
Surely, Look at my sample, where I said it is not workin. The apply my patch and the size is much smaller, cause the type info is now not serialized |
Any if you have circular references you could not fix this problem by changeing order of the knowntypes |
@jogibear9988
Made using your original code as a reference: [Fact]
public void WritesManifestEvenIfKnown()
{
var stream = new MemoryStream();
var msg = new Temp() { SubArray = new object[] { 1, 2, 3 } };
var serializer = new Serializer(new SerializerOptions(knownTypes: new[] { typeof(Temp), typeof(object[]) }));
serializer.Serialize(msg, stream);
var bytes = stream.ToArray();
stream.Position = 0;
var res = serializer.Deserialize(stream);
var sb = new StringBuilder();
foreach (var b in bytes) {
sb.Append($"{b:x2} ");
}
_output.WriteLine(sb.ToString());
} As you can see, they are identical, so I can't really see the original problem |
@Arkatufus I've now attached a test wich fails if you revert the changes from my commit 6bafc4c |
Thanks @jogibear9988 ! |
@jogibear9988 I feel a lot safer if we remove all modified codes that can't be reached by unit testing. |
bugfix not using know serializers when defined
fix for #183
what is still a problem:
if we have two classes wich reference one another, the known type is not found on one, cause one of them is added later.
also the order of the adding of the classes is important:
for example, this will work:
this not:
see changed order of types in the Serializer constructor