XmlSerialization and version dependency

J

Jack Wright

Dear All,
I have a stub application that launches from via No Touch
Deployment...
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
created
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
xmlReader)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean
asyncCall)
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...

TALIA

Many Regards
Jack
 
H

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
http://msdn.microsoft.com/library/e...onserializationbinderclassbindtotypetopic.asp.

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
http://www.codeproject.com/script/comments/forums.asp?msg=863688&forumid=1649#xx863688xx.

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
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconassemblyversionredirection.asp
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

Top