切换到发布版本会导致Web参考中的运行时错误 [英] Switching to Release Build causes runtime error in Web Reference

查看:52
本文介绍了切换到发布版本会导致Web参考中的运行时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了由Visual Studio 2005生成的SOAP Web引用问题(.NET框架为v2.0.50727.42)-在Debug构建配置下(可以使用数月),它可以正常工作,但是现在我想上线并使用Release配置进行编译,它已停止工作.

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.

每当我在Web Reference上调用方法时,都会在运行时引发异常.最常见的例外是:

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'

项目和生成的Web参考的语言是VB.NET,而不是C#.由于生成的Reference.vb代码实际上并没有改变,仅是构建类型,我在那里什么都找不到,而且我显然无法调试Release版本.

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.

我注意到Release版本从主版本中分离出* .XmlSerializers.dll程序集.是否存在已知问题?

I've noticed that the Release build splits off a *.XmlSerializers.dll assembly from the main build. Are there known problems with this?

出于明显的原因,我宁愿不使用Debug版本.也许我应该读一些有关CodeDOM的信息,我一直在意!

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.

我不确定序列化程序集的根本问题是什么.如果有机会根据第二个建议中的建议调试Release程序集,我将提供更新.

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.

推荐答案

尽管我对如何解决此问题有一些想法,但我没有答案.

I do not have an answer for you, though I have some thoughts on how to troubleshoot this issue.

  1. 由于这是仅在RELEASE构建而不是DEBUG构建中发生的运行时错误,我想知道VB编译器是否发出相同的IL.您可能想做的是编译程序集的DEBUG版本,然后编译程序集的RELEASE版本.拥有该程序集的DEBUG和RELEASE版本后,请使用ILDASM.exe对这两个程序集进行反汇编.将文件另存为文本,然后使用WinDiff.exe进行比较.这可能会或可能不会为您提供一些线索.
  2. 您可能想要更改RELEASE配置的项目设置以生成PDB(/debug:pdbonly).只要您从Visual Studio中启动该过程,就可以进行调试.
  3. 生成的* .XmlSerializers.dll程序集旨在改进导致序列化发生的初始调用.作为故障排除步骤,您可以在项目属性的RELEASE配置中将其关闭,以查看是否仍然存在相同的问题.

我希望这会有所帮助.

这篇关于切换到发布版本会导致Web参考中的运行时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆