I've got a problem with a SOAP Web Reference that was generated by Visual Studio 2005 (.NET framework is v2.0.50727.42) - it works fine under the Debug build configuration (and has for months) but now that I want to go live and have compiled using the Release configuration, it has stopped working.
Exceptions are raised at runtime whenever I call a method on the Web Reference. The most common exception is:
System.InvalidOperationException: There was an error generating the XML document. ---> System.ArgumentException: Item has already been added. Key in dictionary: 'MayriseWebServices.RefuseService.PremiseSummaryStructure' Key being added: 'MayriseWebServices.RefuseService.PremiseSummaryStructure'
The language for the project and the generated Web Reference is VB.NET rather than C#. As the generated Reference.vb code doesn't actually change, just the build type, I can't find anything there, and I obviously can't debug the Release build.
I've noticed that the Release build splits off a *.XmlSerializers.dll assembly from the main build. Are there known problems with this?
I'd rather not go live with the Debug build for obvious reasons. Maybe I should do some reading about CodeDOM, I have been meaning to!
I should mention that I've found a post with reasons why a Release build will run differently but it seems to be focused on C++.
Thanks for any help you can give.
UPDATE: The third suggestion to turn off the serialization assemblies has fixed the problem. I changed the "Generate serialization assemblies" setting from "Auto" to "Off" in the Advanced Compile Options, and my tests pass now. I wasn't aware of that setting.
I'm not sure what the underlying problem with the serialization assemblies is. I'll provide an update if I get a chance to debug the Release assembly using your advice in the second suggestion.