XmlSerialization and version dependency


Jack Wright

Dear All,
I have a stub application that launches from via No Touch
I have a user defined Object defined in a dll say 1.dll...this dll has
a reference to myStandard.dll...if I change myStandard.dll and don't
compile 1.dll and I call a WebMethod in the Main before any UI is
I get the following error...
InnnerException: There is an error in XML document (1, 337).
Stack Trace: at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
xmlReader, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)

but if I call it on a UI button this error does not come...does anyone
know why?

Please help...


Many Regards

Heath Stewart [MSFT]

If you're changing the assembly version - which you should be doing -
then the Type is actually changed (it may have the same namespace and
class name, but it has a different version; remember that a Type is
comprised of the namespace + class name, assembly, asembly version,
culture, and public key token).

See the SerializationBinder.BindToType method in MSDN at

Override the method in your own binder to bind to the same class but
with a different version. I wrote an example a while back on
www.codeproject.com at

It could also be that you need to create a publisher policy if you
change the version of the dependent assembly so that the other assembly
can resolve it correctly. Read
for more information about redirecting assembly versions.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question