21.09.2010 г.

Can't debug Silverlight in Firefox - the solution!

Some months ago I was actively developing a Silverlight designer,about which I posted here.
Lately I found a small irritating bug in the designer and started debugging it. The strange thing was that I was practically unable to do that. The debugger was telling me that no debug symbols had been loaded for my silverlight application. For me this is one of the most annoying errors.
However, I spent some time trying to enable silverlight debugging with no success. I debugged it with MessageBox.Show(); and then forgot about the problem.
Today I found myself another bug and decided that it is time to get deeper into the debugging problem.
So to be sure that you will be able to debug silverlight applications:
1) Be sure to check the option for debugging Silverlight in the hosting Web project.
Web project -> Properties -> Web -> under Debuggers
2) There is a tab Silverlight Applications in web project's properties. You should add your project there.
3) Be sure that your ClientBin (or the folder where your web application expects your silverlight xap-s to reside) folder has the latest .xap packages. If not make sure that after building the silverlight project the result .xap goes there. That can be done with postbuild events.

If nothing of these helps, as it happened with me, read further:
This is a solution for debugging with Firefox:

Here’s how to ensure the VS debugger attaches to the Silverlight app for debugging:

* In Firefox address bar type about:config
* Read the warning, choose your preference to always remind you or not and accept
* In the search bar of the config options now type: npctrl
* You should then see the entry: dom.ipc.plugins.enabled.npctrl.dll
* Change the value from true to false (simply double-clicking will change this for you)
* Restart Firefox

Firefox solution source

BTW there is also some valuable comments under this guy's post.