如何在 VS2010 中调试已发布的 XBAP 文件?
我需要通过指定 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
找到了。如果您选择要发布的 .pdb 文件(默认情况下并非如此),“PresentationHost.exe -embedding”将起作用。这是根据我之前看到的情况得出的,一旦应用程序实际加载,调试器似乎有符号,然后就没有了。澄清一下:
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:
如果您有权访问源代码并且部署在本地主机上,则只需在代码中添加 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.