Custom Serializer
See original GitHub issueIm currently trying to get a custom serializer to work (using alpha5). Because I encountered some issues (Deserializer method not called), I created a new xml test project and encountered a other issue. When deserializing a serialized object, I get an InvalidOperationException:
HResult=0x80131509
Message=The XmlReader state should be EndOfFile after this operation.
Source=System.Xml.Linq
StackTrace:
at System.Xml.Linq.XElement.Load(XmlReader reader, LoadOptions options)
at ExtendedXmlSerializer.ExtensionModel.Xml.CustomXmlExtension.Contents.Serializer.Get(IFormatReader parameter)
at ExtendedXmlSerializer.ContentModel.Serializer.Get(IFormatReader reader)
at ExtendedXmlSerializer.ContentModel.Collections.CollectionContentsHandler.Handle(IListInnerContent contents, IReader reader)
at ExtendedXmlSerializer.ContentModel.Content.InnerContentServices.Handle(IListInnerContent contents, IReader reader)
at ExtendedXmlSerializer.ContentModel.Collections.CollectionInnerContentHandler.Execute(IInnerContent parameter)
at ExtendedXmlSerializer.Core.SelectedCommand`1.Execute(T parameter)
at ExtendedXmlSerializer.ContentModel.Content.InnerContentReader.Get(IFormatReader parameter)
at ExtendedXmlSerializer.ContentModel.Serializer.Get(IFormatReader reader)
at ExtendedXmlSerializer.ContentModel.Serializer.Get(IFormatReader reader)
at ExtendedXmlSerializer.ContentModel.Members.MemberSerializer.Get(IFormatReader parameter)
at ExtendedXmlSerializer.ContentModel.Members.MemberHandler.Handle(IInnerContent contents, IMemberSerializer member)
at ExtendedXmlSerializer.ContentModel.Content.InnerContentServices.Handle(IInnerContent contents, IMemberSerializer member)
at ExtendedXmlSerializer.ContentModel.Members.MemberInnerContentHandler.IsSatisfiedBy(IInnerContent parameter)
at ExtendedXmlSerializer.ContentModel.Members.MemberInnerContentHandler.Execute(IInnerContent parameter)
at ExtendedXmlSerializer.ContentModel.Content.InnerContentReader.Get(IFormatReader parameter)
at ExtendedXmlSerializer.ContentModel.Serializer.Get(IFormatReader reader)
at ExtendedXmlSerializer.ContentModel.Serializer.Get(IFormatReader reader)
at ExtendedXmlSerializer.ExtensionModel.Xml.ExtendedXmlSerializer.Deserialize(XmlReader reader)
at ExtendedXmlSerializer.ExtensionModel.Xml.Extensions.Deserialize[T](IExtendedXmlSerializer this, IXmlReaderFactory factory, Stream stream)
at ExtendedXmlSerializer.ExtensionModel.Xml.Extensions.Deserialize[T](IExtendedXmlSerializer this, XmlReaderSettings settings, Stream stream)
at ExtendedXmlSerializer.ExtensionModel.Xml.Extensions.Deserialize[T](IExtendedXmlSerializer this, String data)
at XMLTest.Program.Main(String[] args) in C:\Users\Michi\Programming\Visual Studio\XMLTest\XMLTest\Program.cs:line 23
The code can be found here: https://github.com/michidk/XMLTest/blob/master/XMLTest/Program.cs#L23
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (9 by maintainers)
Top Results From Across the Web
Jackson - Custom Serializer
This quick tutorial will show how to serialize a Java entity with Jackson 2 using a Custom Serializer. If you want to dig...
Read more >How do I use a custom Serializer with Jackson?
You can put @JsonSerialize(using = CustomDateSerializer.class) over any date field of object to be serialized.
Read more >How to write custom converters for JSON serialization - .NET
In this article ... This article shows how to create custom converters for the JSON serialization classes that are provided in the System.Text....
Read more >Creating custom serialization
You can create custom Jackson serializer and deserializer classes to use instead of the default classes. Then, create a custom ObjectMapper to use...
Read more >Jackson - Custom Serializer and Deserializer
The custom deserializer is created by extending the StdDeserializer class. Its deserialize() method receives the parsed JSON as a JsonNode ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve just published 2.0.0-alpha6 https://www.nuget.org/packages/ExtendedXmlSerializer/2.0.0-alpha6
sure thing, @wojtpl2 … I have checked in all my bug fixes. I will update the milestone to reflect the new number as well. 👍
And thanks for the encouragement @TLASZKIE. FWIW, I am using this project on what I am working on now and it is working like a champ. 😃 As an example, can you think of a single .NET serializer in existance that can serialize this class?
We have inheritance, list interface, and a parameterized constructor (with a default value no less!). All of these, in my experience, have caused problems or out-right destruction to any serializer that ventures to tackle it. EXSv2 was able to work with it easily. Very happy with how this has turned out.
I hope to have some more free time next week so that I can finish out the FluentAPI rework, and then documentation to finally get this thing launched.