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.

Xml Deserialization Error

See original GitHub issue

I am getting this error when deserializing an XML string with version 2.1.2:

An attempt was made to load a type with the fully qualified name of ‘http://namespace/file.xsd:myMessage’, but no type could be located with that name.

XML:

<?xml version="1.0"?>
<myMessage xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://namespace/file.xsd">
  <myElement uniqueId="12345"> 
</myMessage>

Class:

// <remarks />
[Serializable]
[XmlType(AnonymousType = true, Namespace = "http://namespace/file.xsd")]
[XmlRoot("myMessage", Namespace = "http://namespace/file.xsd",
    IsNullable = false)]
public class MyMessage
{
    /// <remarks />
    [XmlElement("myElement")]
    public MyElementType MyElement { get; set; }
}

Call to the serializer:

_xmlSerializer.Deserialize<MyMessage>(xml)

Possibly related to #99

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:24 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
Mike-E-angelocommented, Mar 6, 2018

For sure @wojtpl2 … looks like d4d99cc633217f473a9e32e0fb7042892f6369f3 is the winner here. 👍

1reaction
WojciechNagorskicommented, Mar 7, 2018

I’ve just published version 2.1.2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Deserialization error in XML document(1,1)
(1,1) means basically first char of the first line is incorrect and the string can't be deserialized. Share.
Read more >
How to debug XMLSerializer.Deserialize error : 'There is ...
If the serializer cannot match the document with the type passed to the constructor, the type specified by the XmlInclude attribute, or the...
Read more >
there is an error in XML document (2, 2)
Hi FranzBe, When I serialize the declared object and then Deserialize then it is working as expected. However, I have modified the code...
Read more >
Regarding the case where Deserialize fails without ...
This is a problem related to Serialize and Deserialize of XmlSerializer. For a certain XML file, save it with [Code Flagment 1] and...
Read more >
XML Deserialization Error occurs when using SAP WS ...
XML Deserialization Error occurs when using SAP WS Navigator to consume Query as a Web Service in SAP BI 4.x; Error details is...
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