Silverlight Applications Stop Building Properly

It’s happened to me too many times; all of a sudden, my Silverlight code stops working and no matter what I do, nothing changes. After changing tons of stuff, I realize that my breakpoints aren’t being hit…

Breakpoints not being hit The message reads;

The breakpoint will not currently be hit. No symbols have been loaded for this document.

That’s a major clue, a lot of things can cause this, but in my case, it used to work and now it doesn’t. There are absolutely no warnings, no hints or indications of what’s going on.

It turns out that my current code isn’t being used, Visual Studio is using some old version of my code! I can verify this by changing something that’s visual (a label for instance) and sure enough, the label isn’t changed the way it should! If I change the code so that there’s a bug in it, it won’t compile. I fix the bug, and it “compiles” but it doesn’t use my actual code. What to do?

The Solution

These steps solve the problem for me, some of the times…

Empty the debug/bin directory from your Silverlight application. In my case it’s called ImageEvolvatron\ImageEvolvatron.Gui\Bin\Debug and it contains dlls, pdbs, xaps etc. It would appear that these are cached for some reason, but deleting them solves that issue.

Create a bat file to solve this problem if it’s a frequent occurrence.

The Other Solution

These steps solve the problem for me, some of the times…

  1. Stop the Silverlight application
  2. Restart Visual Studio
  3. Stop all ASP.NET Development Servers if they’re running (there’s an icon in the task bar), right click and select “Stop”
     Stop web server
  4. Close all open tabs in firefox/whatever browser you’re using that might be connected to the old code. Stop the entire browser if you have to
  5. Right click on the solution in the solution explorer and selecting “Clean Solution”
  6. Right click again and selecting “Rebuild Solution”

Now it works – for me. Your mileages may vary. I think it’s safe to assume that some of those steps are superfluous, but which ones to skip – that I don’t know.


About mfagerlund
Writes code in my sleep - and sometimes it even compiles!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: