2010-04-13 173 views
2

只是將我的項目遷移到Visual Studio 2010,但目標框架保留爲3.5。 Project包含部分信任的XBAP應用程序和一堆WCF服務。無法使用Visual Studio 2010調試XBAP

調試配置爲使用-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 
--------------------------- 

哪裏是自詡multitargeting?

有沒有人遇到過同樣的問題?

更新:

試圖通過「啓動帶URL的瀏覽器」選項進行調試。調試正在工作,但我得到SecurityException。所以有可能,只需要弄清楚如何使它與「啓動外部程序」選項一起工作。

UPDATE2:

經過什麼PresentationHost其實是加載在這兩種情況下:

「啓動外部程序」 - 在C最新版本(4.0.31106.0):\ WINDOWS \ SYSTEM32 \

「先從URL」瀏覽器 - 由C老版(3.0.6920.4902):\ WINDOWS \ winsxs文件\ x86_wpf-presentationhostexe_31bf3856ad364e35_6.1.7600.16385_none_6fca8974817173aa

回答

0

這是在Visual Studio 2010 RTM的錯誤:

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

解決方法:

  • 分離,然後重新連接 - 確保 「附加到」 正確指定。
  • 修改EXE的App.Config中:

<配置> <啓動> < supportedRuntime版本= " V2.0.50727 "/> < /啓動> < /配置>

+0

感謝您的答覆。我早些時候嘗試過這個解決方案,它並沒有幫助我。在我的情況下,我不嘗試明確附加到一個進程,我讓Visual Studio運行具有啓動參數的PresentationHost。它出於某種原因不檢測我希望它運行的版本。 – 2010-05-07 19:41:51

+0

您是否嘗試過修改app.config並指定運行時版本?如果沒有app.config,請創建一個! (即使它不是一個託管過程)。調試器將看到配置並使用正確的版本。 – 2010-05-13 15:16:24