  October, 2010    • Randomisation      Silverlight: Why do I
get 0x8000ffff when using WriteableBitmap on an Element
I'm working on a WP7 library which helps analyze your VisualTree
and to provide a visual aid, I take WriteableBitmap snaps of the
elements. Unfortunately I (seemingly) randomly encounter the
following exception:       A first chance exception of type
'System.Exception' occurred in System.Windows.dll     When
digging into the exception you may find that the error is
actually a HRESULT which is being bubbled up from the lower
native layer:       E_UNEXPECTED (0x8000ffff)       What's going
on?      You guessed it - this isn't random! In fact, this only
happens on completely obscured (or off screen) elements which
have never had a chance to render. In this case when you try to
take a WriteableBitmap snap, instead of it forcing the control
to render, it simply fails. This will hit you in the case of any
element that has always been obscured. As soon as the element is
unobscured it will be go