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.

Deserialization issue

See original GitHub issue

Hello there! I’m having an issue trying to make this library to work and would appreciate some help.

I have an XML like this:

<TObjItemData>
      <Id>11546</Id>
      <Name>SomeObjectName</Name>
      ...
</TObjItemData>

it is a part of a larger XML, but i need just this one Element and I send it to the Deserialize method as text. The class looks like this:

    [XmlRoot("TObjItemData")]
    public class DbD2Object : DataEntity
    {
        [XmlElement("Id")]
        public long Id { get; set; }

        [XmlElement("Name")]
        public string Name { get; set; }
        ....
    }

I tried all sorts of initialization of the serializer, but I think this should be the correct one (according to doc):

    IExtendedXmlSerializer serializer = new ConfigurationContainer()
        .ConfigureType<DbD2Object>().Name("TObjItemData")
        .Create();

Then I call the Deserialize<> method like this:

DbD2Object obj = serializer.Deserialize<DbD2Object>(element.ToString());

I tried all sorts of things but no matter what I do I always get the same exception.

System.InvalidOperationException: 'An attempt was made to load a type with the fully qualified name of 'TObjItemData', but no type could be located with that name.'

I honestly don’t understand what “fully qualified name” means in this context, but I guess it has something to do with those xmlns attributes that are in every single XML in the documentation (never used them before tbh). My problem is that I cannot change the input XML in any way, as I am receiving it from an external source and I’m using the library for deserialization only.

Thanks, Esso

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
Mike-E-angelocommented, Jan 26, 2018

Going to close this issue now. Please let me know if there are any further problems you find with it and we will reopen it. Please also feel free to open a new issue altogether if you feel that is more appropriate. 👍

1reaction
Mike-E-angelocommented, Jan 25, 2018

Alright @esso23 you should be set to go here. I’ve updated the converter registrations to utilize a component we already had within our code, which was taken from the classic .NET Framework (KeyedByTypeCollection) and ensures that items that are added are keyed by their type and only get added once. This should throw any errors in case there are two objects with the same type, but it also removes items as well before adding it.

Additionally, I’ve exposed all components around the DefaultExtensions and you should be able to extend extensions more easily now.

You can find the latest version here on our preview feed: https://www.myget.org/F/wojtpl2/api/v3/index.json

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deserialization of untrusted data
Data which is untrusted cannot be trusted to be well formed. Malformed data or unexpected data could be used to abuse application logic,...
Read more >
The Java Deserialization Problem
The Java deserialization problem occurs when applications deserialize data from untrusted sources and is one of the most widespread security ...
Read more >
Explaining Java Deserialization Vulnerabilities (Part 1)
A Java deserialize vulnerability is a security vulnerability that occurs when a malicious user tries to insert a modified serialized object into ...
Read more >
Serialization and deserialization in Java
A Java deserialize vulnerability is a security vulnerability that occurs when a malicious user tries to insert a modified serialized object into ...
Read more >
Deserialization Bugs In The Wild - Vickie Li's Security Blog
A totally unscientific analysis of deserialization vulnerabilities found in the wild.
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