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

发布于 2024-09-19 12:56:44 字数 910 浏览 2 评论 0原文

我需要通过指定 URL 或理想情况下从我打算将其部署到的 Web 应用程序内来调试完全信任的应用程序。我已尝试以下操作:

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

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

System.ArgumentException:不支持 URI 格式。

 在 System.IO.Path.NormalizePath(...)
   在 System.IO.FileStream.Init(...)
   在 System.IO.FileStream..ctor(...)
   在 System.Windows.Interop.ApplicationLauncherXappDebug.GetIdFromManifest(...)
   在 System.Windows.Interop.ApplicationLauncherXappDebug.GetApplicationIdentity()
   在 System.Windows.Interop.ApplicationLauncherXappDebug.Initialize()
   在 System.Windows.Interop.DocObjHost.MS.Internal.AppModel.IBrowserHostServices.Run(...)

I need to debug a full-trust application either by specifying a URL or, ideally, from within the web app I am intending to deploy it to. I've tried the following:

  • Running "PresentationHost.exe -embedding" from the command-line, attaching through Visual Studio. The IDE shows that my breakpoints are valid until I actually attempt to load the .xbap file, at which point it shows that there are no symbols loaded. None of my breakpoints are hit. I've tried "mage -cc" before doing this per several recommendations elsewhere.

  • Hard-coded URL in the project's Debug panel then F5. Alternatively, "PresentationHost.exe -embedding -debug" and attach to process then load the .xbap in IE. Both result in the following error when the page appears:

System.ArgumentException: URI formats are not supported.

   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(...)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

过期情话 2024-09-26 12:56:44

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

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

Found it. The "PresentationHost.exe -embedding" will work, provided that you select the .pdb file to be published, which it is not by default. This follows from what I saw before, where the debugger appeared to have symbols then not, once the app actually loaded. To clarify:

  • Go into the Publish tab on the project properties
  • Click "Application Files..."
  • Check "Show all files"
  • Select the .pdb file for the executable to be included.
  • Republish
  • PresentationHost.exe -embedding
  • Attach to process or set the project to run this out of the debug tab
  • Launch the web page in a browser and navigate to the xbap file, breakpoints should be hit now.
静若繁花 2024-09-26 12:56:44

如果您有权访问源代码并且部署在本地主机上,则只需在代码中添加 System.Diagnostics.Debugger.Launch(); 即可。这将允许您将 VS 附加到 XBAP 正在使用的任何进程。

If you have access to source code and you deploy on localhost you can simply add System.Diagnostics.Debugger.Launch(); in your code. This will allow You to attach with VS to any process your XBAP is using.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文