如何在VS2010中调试已发布的XBAP文件?

fla*_*ine 5 c# debugging xbap

我需要通过指定URL来调试完全信任的应用程序,或者理想情况下,从我打算将其部署到的Web应用程序中调试.我尝试过以下方法:

  • 从命令行运行"PresentationHost.exe -embedding",通过Visual Studio附加.IDE显示我的断点有效,直到我实际尝试加载.xbap文件,此时它显示没有加载符号.我的断点都没有被击中.我在其他地方的几个建议之前尝试了"mage -cc".

  • 项目的Debug面板中的硬编码URL,然后是F5.或者,"PresentationHost.exe -embedding -debug"并附加到进程然后在IE中加载.xbap.当页面出现时,两者都会导致以下错误:

System.ArgumentException:不支持URI格式.

   at System.IO.Path.NormalizePath(...)
   at System.IO.FileStream.Init(...)
   at System.IO.FileStream..ctor(...)
   at System.Windows.Interop.ApplicationLauncherXappDebug.GetIdFromManifest(...)
   at System.Windows.Interop.ApplicationLauncherXappDebug.GetApplicationIdentity()
   at System.Windows.Interop.ApplicationLauncherXappDebug.Initialize()
   at System.Windows.Interop.DocObjHost.MS.Internal.AppModel.IBrowserHostServices.Run(...)
Run Code Online (Sandbox Code Playgroud)

fla*_*ine 4

找到了。如果您选择要发布的 .pdb 文件(默认情况下并非如此),“PresentationHost.exe -embedding”将起作用。这是根据我之前看到的情况得出的,一旦应用程序实际加载,调试器似乎有符号,然后就没有了。澄清:

  • 进入项目属性上的“发布”选项卡
  • 单击“应用程序文件...”
  • 勾选“显示所有文件”
  • 选择要包含的可执行文件的 .pdb 文件。
  • 重新发布
  • PresentationHost.exe-嵌入
  • 附加到进程或设置项目以在调试选项卡中运行它
  • 在浏览器中启动网页并导航到 xbap 文件,现在应该命中断点。