2

刚刚将我的项目迁移到 Visual Studio 2010,但目标框架仍然是 3.5。项目包含一个部分信任的 XBAP 应用程序和一堆 WCF 服务。

调试配置为使用 -debug 和 -debugSecurityZoneUrl 参数启动 PresentationHost.exe。

在 VS2008 下一切正常,在 VS2010 Beta2 中(不确定 RC),但在 VS2010 RTM 下调试由于某种原因不起作用。应用程序运行,但没有遇到任何断点。如果发生例如异常,消息框会出现“你想调试还是关闭...”,在我选择“调试”选项后,会出现新的奇怪消息框:

---------------------------
Warning
---------------------------
A debugger is attached to PresentationHost.exe but not configured to debug 
this unhandled exception. To debug this exception, detach the current debugger.

An unhandled exception was raised from Microsoft .NET Framework v 1.0, 1.1, or 2.0, 
but the current debugger is configured to debug Microsoft .NET Framework v4.0 code. 
Examine the exception using the SOS tool.
---------------------------
OK   
---------------------------

吹嘘的多目标在哪里?

有没有人遇到过同样的问题?

更新:

尝试使用“使用 URL 启动浏览器”选项进行调试。调试工作正常,但我得到 SecurityException。所以这是可能的,只需要弄清楚如何使它与“启动外部程序”选项一起工作。

更新2:

检查了 PresentationHost 在两种情况下实际加载的内容:

“启动外部程序” - 来自 C:\Windows\System32\ 的最新版本 (4.0.31106.0)

“使用 URL 启动浏览器” - 旧版本 (3.0.6920.4902) 来自 C:\Windows\winsxs\x86_wpf-presentationhostexe_31bf3856ad364e35_6.1.7600.16385_none_6fca8974817173aa

4

1 回答 1

0

这是 Visual Studio 2010 RTM 中的一个错误:

https://connect.microsoft.com/VisualStudio/feedback/details/487949/debugging-external-application

解决方法:

  • 分离并重新附加 - 确保正确指定“附加到”。
  • 修改EXE的App.Config:

<configuration> <startup> <supportedRuntime version="v2.0.50727" /> </startup> </configuration>

于 2010-05-04T22:13:16.093 回答