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.

Serialization Problem

See original GitHub issue

Hi,

I want to deserialize a xml file into a class (Scene.cs) containing this variable: public List<GameObject> SceneGraph { get; set; } This is the GameObject class: I’m trying to serialize this class: https://github.com/michidk/BrokenEngine/blob/master/BrokenEngine/GameObject.cs

My xml file currently looks like this:

<?xml version="1.0"?>
<Scene xmlns="BrokenEngine.Scene">
  <SceneGraph>
    <GameObject type="BrokenEngine.GameObject">
      <Name>Super Cool GameObject</Name>
      <Position type="OpenTK.Vector3">
        <X>1</X>
        <Y>1</Y>
        <Z>1</Z>
      </Position>
    </GameObject>
  </SceneGraph>
</Scene>

I’ve already added a public, parameterless constructor. I get the following error: {“Value cannot be null.\r\nParameter name: method”} What do I do wrong?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Mike-E-angelocommented, Feb 10, 2017

Correct, @michidk. In fact I believe at the moment if you place an XmlElementAttribute on the private children field it will pick it up as a member to emit. Since it is a List<>, it will satisfy the Collection condition above and emit accordingly.

1reaction
michidkcommented, Feb 9, 2017

Great job so far!

It would be no problem for me to change GameObject so that it implements ICollection. Would this make this class de-/serializeable? If so, this is great and all I need.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Serialization/deserialization problems
If you face a serialization/deserialization error, it is likely that you need to provide a custom serializer/deserializer. Here is one of the known...
Read more >
c# - Serialization problem
Now, the problem appears when from Project A I try to serialize the objects from B. An exception is thrown that says a...
Read more >
Serialize and Deserialize Binary Tree
Can you solve this real interview question? Serialize and Deserialize Binary Tree - Serialization is the process of converting a data structure or...
Read more >
Serialization
Serializing the data structure in an architecture-independent format means preventing the problems of byte ordering, memory layout, or simply different ways ...
Read more >
Why We Hate Java Serialization And What We're Doing About ...
Java Serialization is well known to be one of the worst features of ... The problem is that, while most of the industry...
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