Reputation: 165
Our .NET 4 application consuming an external .NET webservice and everything worked fine in debug mode but in release mode we got a serialization error. Checked the SOAP request that was sent to service and found some differences in one of the element
SOAP Element in Debug mode
<Key>pswhistory</Key>
<Value xsi:type="ArrayOfString">
<string>a</string>
<string>B</string>
</Value>
Soap Element in Release mode
<Key>pswhistory</Key>
<Value xmlns:q1="http://tempuri.org/" xsi:type="q1:ArrayOfString">
<q1:string>a</q1:string>
<q1:string>B</q1:string>
</Value>
Can somebody explain this behaviour with XMLSerializer?
Thanks
Upvotes: 0
Views: 1108
Reputation: 165
@Phil - you gussed it right. Namespace was not correct in the soap message when the message was generated in release mode.
Issue was because of auto generated serialization assembly. By turning off the "Generate Serialization Assembly" option in project's property, issue got resolved. When this option is turned ON, compiler uses sgen.exe to generate serialization assembly for all the types in the assembly which would increase the application startup time. For some reason,generated assembly was referring to wrong assembly. Please refer the below ink for more details
http://msdn.microsoft.com/en-us/library/bk3w6240(VS.80).aspx
Serialization Assembly. Is it needed or not?
Upvotes: 1
Reputation: 1973
Sounds like a namespace that needs to be explicitly declared. Could you attach a sample of your code/business object that you are trying to serialize?
Upvotes: 0