question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom Serializer

See original GitHub issue

Im 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:closed
  • Created 6 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
WojciechNagorskicommented, Aug 31, 2017
2reactions
Mike-E-angelocommented, Aug 25, 2017

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?

public sealed class Account : QueryBase
{
	public Account(Uri location, IList<Query> queries, QueryState state = QueryState.Active) : base(state)
	{
		Location = location;
		Key = key;
		Queries = queries;
	}

	public Uri Location { get; }

	public IList<Query> Queries { get; }
}

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found