25
votes

I am using VS2010, and Silverlight 4. When I run my code the debugging does not work (I get the above error on my breakpoints.

When I clean my solution a warning comes up saying that the system cannot find the file specified (a project dll). It is looking in the right path (..\debug), but there is no dll present.

I started a new Silverlight 4 project, and get the same error.

Sometime's the debugging does work (I am not sure if/what anything changed, but on one occasion I was surprised that my breakpoints worked. After changing one thing the breakpoints stopped working)

17

17 Answers

27
votes

Make sure you are using Internet Explorer to debug your Silverlight app. Make sure you are using Internet Explorer as your default browser. If you are not debuggin in IE, the IDE will not recognise breakpoints.

51
votes

For me I had to go in the properties of the Web project » Web tab » Check 'Silverlight' in the Debugger section at the bottom. enter image description here

6
votes

For Silverlight applications enabling hit of breakpoint:

  1. In the Solution explorer right click on the Web Side of the project and select properties.
  2. Navigate to Web Tab, in the property window that opened.
  3. Scroll down and check the Silverlight option in Debugger section.
5
votes

Clean both the regular project and Web project separately. Build the web project. Update the web reference. Build the regular project.

3
votes

What solved it for me was turning off the read-only flag on the xap file. I think it was set by Team Foundation Server.

3
votes

Click on "Attach to Process" option from "Debug" menu. Click the "Select" button. Then select "Debug these code types" option and select "Silverlight" checkbox and Click OK.

1
votes

You can enable firefox debugging by disabling isolation feature in few simple steps. I have written a post about it on here - Enable Visual Studio Debugging in Firefox.

1
votes

I have one more solution to this problem, which solved it in my case.

When you are attaching debugger to 'iexplorer' process click on the "Select" button, near "Attatch To" option and then select "Silverlight" code type. If box with communicate such as "Install Silverlight Runtime" appears then, well, that's the point :)

1
votes

While working with the Silverlight application, I found that it is not following the breakpoints while running the application. Please suggest a way so that I can debug the Silverlight application using the breakpoints?

Solution

If you are facing the same issue in Internet Explorer and my friend @debug_mode is still searching the way to debug it Winking smile, you should first check whether the Silverlight debugging is enabled for your Silverlight project. To do this, just follow the below mentioned steps:

  • Right click on the Web Application project that comes with Silverlight project.
  • From the context menu, chose "Properties". This will open the properties window in the screen. Image
  • As shown in the above screenshot, click the tab named "Web" from the left panel. This will open the web settings window in the right panel
  • Scroll the Window down until you see the "Debuggers" group (as shown above)
  • There the checkbox for "Silverlight" should be checked by default, if not click it to check.
  • Save settings and restart the application in debug mode by pressing F5
0
votes

It sounds like you are either loading the release version of your code or an old version of your code.

If you do a clean and then build does the problem "go away" - at least for a while.

Make sure that when you finish running your application you close the web browser. You might even have to stop the web server that Visual Studio starts for you.

0
votes

I had the same issue. Here's how I eventually got it working:

  • you need a web project to host the silverlight control. just letting it create a test file doesn't seem to work (i.e. you need http://localhost... instead of file://...)
  • when attaching to IE, don't just pick the iexplore.exe that has the title of your application, pick one that has "Silverlight, x86" in the "Type" column.
0
votes

Yeah as others have said, you need to use Internet explorer to be able to debug Silverlight applications. Stupid or What! If you use Chrome or Firefox for regular browsing, you can get an extension for Visual Studio 2010 using nuget. I wrote a short blog about it here

0
votes

Yet another solution as nothing here worked for me. Try deleting the xap file (default location is the Client\myproject.xap in the web project) and let it re-generate. If it doesn't regenerate when you build, there is a problem with how your SL application is referenced in the web project and the solution here should fix it:

.Xap file is not generated in Sivlerlight Web Application

0
votes

In my case, I knew the uploaded files were uploaded and so I didn't re-upload them. However that is what fixed it.

Clean -> Rebuild -> Upload

0
votes

What solved it for me was turning off caching in ie:

Settings - Internet Options - General - 
    The Settings-button under 'Browsing history' - 
    checkmark in 'Everytime I visit the webpage'
0
votes

In the hope this can help someone. I have Resharper installed and it seems like the Resharper Build has trouble correctly building Silverlight Applications. Once I turned it off, the error went away.

-1
votes

For me, what worked was unmark the 'Optimize code' option inside the silverlight project properties page. Using Visual Studio 2015.