Debugging silverlight application problem - silverlight

My VS2010 doesn't stop at breakpoints inside of silverlight application. It appears that no symbols for it have been loaded during debugging. When I hover over the break point it says "The braekpoint will not currently be hit, no symbols have been loaded".
I have tried all of possible solutions offered by google and have no success. The problem occurs even when I create brand new silverlight app hosted by an ASP .NET web project. All of my project configuration looks fine - silverlight debugging is enabled in the Web project.
I am using silverlight 4.
here a link to the sample project created out from the tepmlate.
Any thoughts ?
P.S I just tried to reinstall VS2010 and the problem still exists.
EDIT: I just tested the same project on another machine and it stops at the break point it seams that the problem is somewhere in the configuration of VS or silverlight.
with Matt Dotson's help I managed to attach the debugger manually. However this solution is not good enough for daily use.

Depending on my experience in Silverlight following these steps keep your project debug-gable.
Condition 1>
Firstly we need to be ensure that in Web Project's properties there is a Web section, as you see below Silverlight checkbox must be checked.
Condition 2>
Follow In Menu Debug => Attach Debugger>
Visual Studio sometimes can't attach debugging platform you need to lead the way :) . By this way you may debug other platforms,(also you may debug your product platform but pdb files must be sync and don't forget you may suspend your product platform using this).
Condition 3> Your default web browser may be Firefox,Chrome or other than IE.By Visual Studio default try to attach to IE. But when you run VS calls default browser,so you need to have a manual attachment in Condition 2 or set your default browser by right clicking on default page > Browse with .
Condition 4> There is xap file generally located in web project\ClientBin directory. Sometimes after build operations this file can't be replaced and your ProjectDll and your Project PDB files not be sync. This cause wrong line match while debugging or can't find a debugging file attached caution. I strongly suggest delete all generated files in Bus project and delete Clientbin\ProjectName.xap file. After rebuild all it must be ok!
Hope helps.

What broswer are you using? You need to be using Internet Explorer to debug silverlight projects.

I have had a similar frustrating experience with this but in my case the solution was very simple. It seems that somehow, and I really have no idea how, the debugger option for Silverlight had become unchecked in the properties on the hosting ASP.NET project.
I just assumed that as I had been previously debugging, this option was set and I didn't bother to make sure that this was this case. Just goes to show that one should always check the basics first; if I had done that it would have saved me some time.
To check this in VS2010, right-click on the project and select properties, change to the Web tab and check the Silverlight option at the bottom of the page, in the debuggers section.

Also see the debugger to a silverlight process
http://msdn.microsoft.com/en-us/library/cc838267(VS.95).aspx
If that doesn't work, then
reset iis (if you are debugging in that)
delete temporary asp.net files (%SystemRoot%\Microsoft.NET\Framework\versionNumber\Temporary ASP.NET Files)
clean and rebuild your solution

The resolution came after 2 days of headbanging. It appears that the link which Malcolm gave covers exactly my problem but my I was narrow-minded enough not to pay it enough attention because when I run the debugger as long with the app my default browser was FF. So I thought that after the FF starts I can load the page from IE or Chrome.
Actually the problem is that the debugger cannot be attached to the silverlight project because of the FF. And when I load the app from IE or Chrome the debugger dis still not attached.
Thanks to everyone that tried to help.

if you have multiple project, Rebuild the project separately that you want break point. Its work for me

Try also picking internet explorer from browser list menu as your browser

Related

Silverlight object not showing - xap downloading but not launching

After downloading the xap file the Silverlight object remains empty or does not showing.
I tried refreshing the deployed site binaries and the xap but unsuccessfully.
Does anybody has some idea what is happening.
BTW. I have another SL site in the same domain and in the same application pool that starts without problem.
Is your startup object set correctly in project properties? This sort of situation happens if you e.g. move your App class to a different namespace but forget to update the startup object field in settings.
As they are on the same domain, change the site page that is working to point at the faulty XAP. Then you will know if it is a bug in the hosting page or the XAP file.
Also try Silverlight Spy (has free trial period) to see if the Silverlight XAP is valid.
Xaps are just Zip files if you rename them, so you can do some very basic checks manually.
Silverlight applications are client side, so application pool of server has no whatsoever relationship to it.
If you get a blank page (you don't even see the loader of Silverlight or you see it and it hangs) this means your Silverlight application has crashed.
Try to debug and find out what is going on. You probably have some reference issues or XAML errors.
See if all the references are copied into the XAP, (rename .xaml file to .zip and open it).
Look at the 'Output' window in Visual Studio during start of the application.
And last but not least, check your html code of your .HTML file, check the name of the XAP file
Check if your server serves .xap files if not you have to add it to the mime types list
Firstly thanks to everyone for the advices. Problem is solved. Unfortunately, I still does not know the exact reason for the error. The problem was caused Plesk control panel of my hosting company that has changed some settings in web.config files when I asked then to switch a web service under a separate application pool. When we restore a backup copy of web.config silverlight page showed again. I'm not sure which is the exact cause of the problem, but this experience could be of help to all who find themselves in a similar situation.
Normally this happens to me, when I have different event triggers with the same name;
I need to change the name I give to the triggers.

SIlverlight XAP file not refreshing when debugging application

I work on a team building Silverlight apps (version 4). We use SVN and all work on separate parts of the code, and regularly update the project with latest code. The Silverlight app runs from an ASP.NET web app. We are having very frustrating issues when updating our code. It seems like old versions of the XAP are being cached.
Example: Francisco changes the wording of a popup dialog, and commits his changes. A very simple change, what could possibly go wrong? I get the latest code. I see the new code in my IDE (VS2010), and run it. When I view that dialog, it does not have the new wording, even though I can see the new wording in my files. I put a breakpoint on the code right where the change is, but when I run the app, the breakpoint is disabled!
I try Clean build of the Silverlight and the Web host. I kill my local ASP.NET development server. I run the app - same thing! I delete the xap from ClientBin. No good.
Each of us on the team are experiencing this issue. Now we occasionally solve it, but are never sure what exactly fixed things, which is not satisfactory.
There must be some setting or something that we are missing. You would think that deleting the ClientBin xap file would solve it, as the new XAP must come from compiling the Silverlight app, right?
If you've seen this problem before and have a real solution, please let me know. (The solution of "format your hard drive and re-install everything" will NOT be accepted!)
Thank you,
Daniel Wiliams
I recommend that you use IE for Silverlight development. See also this answer.
The problem with using Firefox for development is that Firefox runs plugins in a separate process (plugin-container.exe). When launching the debugger, VS doesn't know that Silverlight won't be running from the process it launched, so it doesn't attach to the correct process. The breakpoints in Silverlight code appear not to work because the VS debugger hasn't attached to any process running the Silverlight code.
I believe it's possible to disable the use of the plugin-container.exe process (see, for example, LIMPET235's post here), but that won't fix the apparent caching you're also experiencing.
I used to use Firefox for Silverlight development, but I found that things worked much more smoothly when I switched to using IE.
First of all, could you please check is your .xap file also included into source control?
it should not be included..., no need IMHO.
Most likely your xap file is set to read only.
go to that file location and make ClientBin folder not read only if is.
I've seen this before the XAP file is cached. Try emptying your browsers cache and then putting a query string on the XAP. So your XAP reference would look something like Foo.xap?1234
couple things to check.
Make sure your silverlight project's output path is correct.
Make sure your silverlight application has been added to your web app project.
Enable silverlight debugging in your web app project.
Set the silverlight project as a dependency in your web application's settings
The solution of "format your hard drive and re-install everything" will NOT be accepted!
Format your hard drive and install Linux (:
More to the point, configure the Silverlight Applications tab in the SomeSilverlightApp.Web project to copy the xap file from the SomeSilverlightApp project to the ClientBin folder which shows there by default.
The ClientBin folder is also part of the SomeSilverlightApp.Web project in my case and the xap properties are set to CopyToOutputDirectory: Always so that it also gets deployed.
This is probably not the right solution but it works here and I have not time to try to investigate this weird logic.

Symbols not loading for Silverlight app on VS 2010

Hi I have a silverlight application pointing to Silverlight 3. I use VS 2010 Ultimate. When i run it in debug mode or attach to process, break points will be highlighted with yellow exclamations saying symbols are not loaded. I tried the solution given here: http://social.msdn.microsoft.com/Forums/en/vsdebug/thread/7bf5a77b-c30d-4674-a8fc-c8fe46ce676b
It points to a pdb file on Framework's temp folder and says Symbols loaded. I tried to load the symbols manually by going to Symbol Settings. Even that did not help. Any idea how to fix?
Another step to take when Silverlight debugging doesn't work is to clear the cache of the browser.
Also make sure the properties in the web project hosting silverlight has silverlight debugger enabled. Web -> Debuggers -> Silverlight checked.
What worked for me:
Remove the Silverlight project from my Web project
Clear the Browser Cache for IE
Go to the folder where IE stores its cache and delete Silverlight*.js
Add the Silverlight project reference back to my Web project
Rebuild and start debugging
I don't know why this works but this is how i got it working.
I went to Tools> options> debugging
unchecked "Require source files to exactly match the original version"
Mostly it happens due to mismatched version of Silverlight and SDK. Uninstall both, and install it. I hope that helps.
You can try starting a new instance.
Right click to Web Project, select Debug, Start a new Instance.

Debugging Silverlight Applications

As hard as I try, I cannot get my silverlight app to stop on break points. I've tried both in and out of browser debugging.
Steps I've done:
Repeatedly cleared my internet
cache.
Made sure Silverlight
debugging is enabled in my test web
application.
Made sure symbols are
loaded by placing a reference to the
silverlight app in my test web
application. (I had the hollow red
dot problem, but this fixed it)
Restarted visual studio and the ASP.NET Development Server
Made sure I was attached to the right process by manually attaching to either sllauncher or the browser hosting the silverlight app.
Ensured that the xap file is being updated in the ClientBin directory after rebuilds.
Cleaned and Rebuilt the solution multiple times.
From my searches, I've found that debugging issues are usually caused by one of the above, but nothing seems to work. It looks like I'm debugging, but the application never breaks. Anyone have any experience with this?
Check the properties of the Web Application / Site. In Visual Studio, Right Click --> Properties. Click the 'Web' tab on the lower left. On the bottom under the 'Debuggers' section, ensure that Silverlight is Checked.
Are you use IE for application or other browser? Be sure that you use an IE.

Silverlight Web Project shows install icon when debugging

When I add a Silverlight project to a blank solution, it asks me whether I want to add a web project to host the silverlight page or automatically generate a test page. Oddly enough, when I automatically generate a test page, everything in fine. However, when I add the web project I have problems.
I first get an error saying that it needs System.Web.Silverlight.dll in the bin folder of the web, so I do this. Then when I run it, all I get is the “Install Silverlight” icon. I’ve tried playing with and/or removing the minimum version tag and the version tag, but I just can’t seem to get it to work that way.
Has anyone had this problem before? If so, how did you get around it?
Sounds like you've got an old toolkit installed or the project template is corrupt.
Try a re-install the lattest Silverlight Tools for Visual Studio
To get rid of the first error, go to your references in your web project, and go to the properties for System.Web.Silverlight and go to its properties. Make CopyLocal true.
To get rid of the install icon problem, go to the Silverlight control markup in your aspx page and remove the MinimumVersion attribute. This doesn't seem like te most ideal solution, but at least one can debug.

Resources