|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
XmlSerialization and version dependencyI 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 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/en-us/cpref/html/frlrfsystemruntimeserializationserializationbinderclassbindtotypetopic.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. -- Heath Stewart Software Design Engineer Developer Division Sustained Engineering Microsoft Corporation
Other interesting topics
Threading: ThreadStart vs BeginXXX/EndXXX
Get the parent assembly Bizarre Exception null value .Net Application crash No exception Thrown Re: File.Delete GDI and Image displays Server Freeze .NET 2.0 Beta 1 Isn't this possible in C#??? Error debugging web project. application failed to run when assembly installed in the GAC |
|||||||||||||||||||||||