Silverlight 2 Sys.InvalidOperationException: ImageError error #4001 in control Xaml1

I got this last night while trying to load 2,150 images into a grid. I’m working on a map tiling control for my application because the maps are very large and custom stitched for my application. Incidentally, when loaded up, my IE windows consumes 1.3 Gb of Ram. Um, probably not gonna work in production…

Anyway, it appears that there is a mechanism internal to the System.Windows.Media.Imaging.BitmapImage object that, when instanced using a Uri, will go in search of the thumbs.db object. I have not looked into the source code for this library and I have not tested to see if this is also happening when on the internet but it doesn’t really matter because it is an easy solution.

To resolve the issue I just opened the images folder in IE and viewed it in thumbnail mode. This magically generates the thumbs.db file and the error goes away when I run my application again.

Incidentally, Xaml1 is the auto-generated name of the <asp:Silverlight /> control that is dropped into the test aspx page.

No Comments