Closed mikedavison closed 4 years ago
I'm actually not able to reproduce this. However, in general the serializer needs to be able to reflect the members of the context as it is possible to bind to the context in the same way it is possible to bind to other fields in the object being serialized.
In general, I would recommend keeping the context simple and only passing the context needed for a given operation. For example, I can't think of any reason why the serializer itself would be included in the context.
This error might be because I am not understanding what the use of "context" is.
I have a context class that looks like this:
Note the context class contains the serializer. The class to be deserialized is:
After setting up the stream and parameters I can successfully call the Deserializer method using the following:
However if I deserialize using the context:
FileMetrics fm = tc.serializer.Deserialize<FileMetrics>(tc.stream, tc);
It fails with OverflowException error. When I debug the code here is what I see. Looking at your classTypeNode.cs
with a breakpoint on line 131var attributes = memberInfo.GetCustomAttributes(true).ToList();
It first iterates through the members of target classFileMetrics
but then for some reason tries to iterate through the members of the classTestContext
and this is when the OverflowException happens.