调试 Silverlight 未命中断点 [英] Debugging Silverlight not hitting breakpoints

查看:32
本文介绍了调试 Silverlight 未命中断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为学校项目开发 Silverlight 应用程序.

i am trying to develop a Silverlight application for a school project.

但是我遇到了 Visual Studio 无法加载断点的问题,这使得使用 ViewModel 调试 Silverlight 应用程序变得非常困难.

But I’m having problems with Visual Studio not loading the break point, making it very hard to debug a Silverlight application using ViewModels.

我尝试在项目属性"->Web"->Silverlight"下添加Silverlight",但没有做任何事情.

I have tried adding "Silverlight" under "Project Properties" -> "Web" -> "Silverlight", but this have done nothing.

这很奇怪,因为它有时会起作用.我曾尝试使用 Chrome、Firefox 和 Internet Explorer.以及 Silverlight 4 和 3.

It is strange because it works some times. I have tried using Chrome, Firefox and Internet Explorer. And with Silverlight 4 and 3.

有人知道解决这个问题的方法吗?

Do any one know a solution for this?

推荐答案

我发现将默认浏览器设置为 IE 会有所帮助(我只将 IE8 与 Silverlight 一起使用).这样,当您按 F5 时,Visual Studio 似乎确实能够将调试器连接到 Silverlight 插件.然后您应该可以使用 VS 调试器.

I found that it helped if you set your default browser to IE (I've only used IE8 with Silverlight). That way, when you press F5, Visual Studio does seem to be able to connect up the debugger to the Silverlight plugin. You should then be able to use the VS debugger.

我在尝试使用 Firefox 调试 Silverlight 应用程序时确实遇到了困难.Firefox 在一个单独的进程中运行插件(包括 Silverlight 插件),我猜 VS 不够聪明,无法意识到 Silverlight 没有在它启动的进程中运行.您可以手动将 VS 调试器附加到插件容器进程,但是(如果我没记错的话),我发现这并不总是可靠的.将我机器的默认浏览器切换到 IE 后,我当然发现调试更可靠.

I certainly had difficulty trying to debug Silverlight applications with Firefox. Firefox runs plugins (including the Silverlight plugin) in a separate process, and I guess VS isn't smart enough to realise that Silverlight isn't running in the process it started. You can manually attach the VS debugger to the plugin-container process, but (if my memory serves me correctly), I didn't find this to always be reliable. I certainly found debugging a lot more reliable after switching my machine's default browser to IE.

此外,在您对 Detroitpro 回答的评论中,您写道

Also, in your comment on Detroitpro's answer, you wrote

它告诉我甚至在我连接浏览器之前还没有加载任何符号,所以我不认为那是[...]

It is telling the that no symbols have been loaded even before i connect with a browser, so i don't think that is is that[...]

如果您在浏览器中启动 Silverlight 应用程序之前设置断点,那么您可能会收到未加载任何符号"消息.当您开始调试时,Visual Studio 将启动 ASP.NET 开发服务器,以提供包含您的 Silverlight 应用程序的 HTML 页面(如果仅此而已).无符号"消息意味着 VS 无法在其调试器连接到的任何进程中找到您放置断点的类.(此时,VS 调试器附加到的唯一进程是 ASP.NET 开发服务器.)打开浏览器查看包含 Silverlight 应用程序的页面,并将 VS 调试器连接到运行 Silverlight 插件的进程后,它应该摆脱无符号"信息.

If you put a breakpoint in before you start your Silverlight app in a browser, then you probably will get a 'no symbols have been loaded' message. When you start debugging, Visual Studio will start the ASP.NET dev server, to serve up an HTML page that contains your Silverlight app if nothing more. The 'no symbols' message means that VS couldn't find the class you put the breakpoint in in any of the processes its debugger is connected to. (At this point, the only process the VS debugger is attached to is the ASP.NET dev server.) Once you open a browser to view a page containing your Silverlight app, and connect the VS debugger to the process running the Silverlight plugin, it should get rid of the 'no symbols' message.

最后,另一种判断 VS 调试器是否已连接到运行代码的进程的方法是打开模块窗口(调试 > Windows > 模块).如果您的应用程序的 DLL 不在模块列表中,并且您尝试在应用程序的代码中放置断点,则会收到未加载符号"消息.

Finally, another way of telling whether the VS debugger has connected to a process running your code is to bring up the Modules window (Debug > Windows > Modules). If your app's DLL isn't in the modules list, you'll get the 'no symbols have been loaded' message if you attempt to put breakpoints in your app's code.

这篇关于调试 Silverlight 未命中断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆