Ah yes the dreaded error #4001. I ran into this problem and every solution Google presented to me did not work. So what’s the situation: I have some images in my Silverlight project with Build Action set to Content. As a result the image is put into the .xap. With my development background I put these images in subfolders in the project as can be seen in the image. The image source property is set to /80 – Resources/10 – Images/ContentImage.png. And this situation resulted in the error.
It turns out that Silverlight breaks because there are spaces in the folder names (the spaces around the dash). When I remove these spaces (in the project folder structure), the error is gone! NB when hosting the image on the webserver (with your .xap for example) spaces in folder names are no problem at all.
2 comments
Great tip ! Just saved my sanity. Love Silverlight, but could do with more explicit exception messages.
Thanks again !
Patrick Bélanger
I was facing an issue while binding Image URL to an Image in Silverlight app. I solved it by publishing the application to IIS instead of running it from the file system . Refer to my blog for more details http://nileshgule.blogspot.com/2011/06/ngtweet-part-5-big-bang-refactoring.html
Nilesh Gule