刚刚将我的项目迁移到 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。所以这是可能的,只需要弄清楚如何使其与“启动外部程序”选项一起工作。
UPDATE2:
检查了PresentationHost在两种情况下实际加载的内容:
“启动外部程序” - 来自C:\ Windows \ System32 \的最新版本(4.0.31106.0)
“使用URL启动浏览器” - 来自C:的旧版本(3.0.6920.4902) \Windows\winsxs\x86_wpf-presentationhostexe_31bf3856ad364e35_6.1.7600.16385_none_6fca8974817173aa
Just migrated my project to Visual Studio 2010, but target framework was left 3.5. Project contains an XBAP app in partial trust and a bunch of WCF services.
Debugging is configured to start PresentationHost.exe with -debug and -debugSecurityZoneUrl parameters.
Under VS2008 everything works fine, and in VS2010 Beta2 (don't sure about RC), but under VS2010 RTM debugging is for some reason doesn't working. Application runs, but doesn't hit any breakpoint. And if for example exception occurs, message box appears "Do you wish to debug or close..." and after I choose "debug" option new weird message box appears:
---------------------------
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
---------------------------
And where is the vaunted multitargeting?
Did anyone have already bumped into same issue?
UPDATE:
Tried to debug with "Start browser with URL" option. Debugging is working, but I get SecurityException. So it is possible, just need to figure out how to make it work with "Start external program" option.
UPDATE2:
Checked what PresentationHost is actually loads in both scenarios:
"Start external program" - Latest version (4.0.31106.0) from C:\Windows\System32\
"Start browser with URL" - Old version (3.0.6920.4902) from C:\Windows\winsxs\x86_wpf-presentationhostexe_31bf3856ad364e35_6.1.7600.16385_none_6fca8974817173aa
发布评论
评论(1)
这是 Visual Studio 2010 RTM 中的错误:
https:// connect.microsoft.com/VisualStudio/feedback/details/487949/debugging-external-application
解决方法:
This is a bug in Visual Studio 2010 RTM:
https://connect.microsoft.com/VisualStudio/feedback/details/487949/debugging-external-application
Workaround: