Freigeben über


XmlTypeAttribute Anonymoustype=true deserialization fails 'System.InvalidOperationException'

 

An exception of type 'System.InvalidOperationException' occurred and was caught.

--------------------------------------------------------------------------------

03/05/2008 19:14:50

Type : System.InvalidOperationException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Message : There is an error in XML document (2, 2).

Source : System.Xml

...

Inner Exception

                ---------------

                Type : System.InvalidOperationException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

                Message : <Account xmlns=''> was not expected.

we got this error  when we tried to deserialize a wsdl generated object in production environment.

but it worked fine in other environments.

Then we found that it was a .Net Sp1 issue.

https://support.microsoft.com/kb/925076/

925076 (https://support.microsoft.com/kb/925076/)FIX: Error message when you use the System.Xml.Serialization.XmlRootAttribute.Namespace property for an anonymous Web Service type in the .NET Framework 2.0

This kb fix is available as part of .Net 2.0 Sp1.

https://support.microsoft.com/kb/945757