Link to home
Start Free TrialLog in
Avatar of razza_b
razza_b

asked on

catastrophic failure exception from hresult 0x8000ffff e_unexpected

Anyone know how i can fix this error - Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

it falls over at line of code - bitmapimage.SetSource(stream);

Ive used jpg, png, gif all same outcome, im returning data from a SL enabled WCF
SNIPPET
using (ms = new MemoryStream(response.Documents[0].Data))
 {
          arr = new byte[ms.Length];
          return arr;
 }

void viewLabelCompleted(object sender, viewLabelCompletedEventArgs e)
        {
            string Message;
            try
            {
                if (e.Error != null)
                {
                    Message = e.Error.Message;
                    MessageDialog dlg = new MessageDialog();
                    dlg.textErrorBlock1.Text = Message;
                    dlg.Show();
                }
                else
                {
                    if (e.Result == null)
                    {
                        MessageDialog dlg = new MessageDialog();
                        dlg.textErrorBlock1.Text = "no results";
                        dlg.Show();
                    }
                    else
                    {
                        BitmapImage bitmapimage = new BitmapImage();
                        MemoryStream stream = new MemoryStream(e.Result);
                        bitmapimage.SetSource(stream);
                        image1.Source = bitmapimage;
                    }
                }
            }
            catch(Exception ex)
            {
                throw ex;
            }
Avatar of HugoHiasl
HugoHiasl

Which BitmapImage class is this?

I only found a BitmapImage class that has a StreamSource property but no method SetSource().

Avatar of razza_b

ASKER

Im using silverlight 4 BitmapImage class, its in th eSystems.Window.Media.Imaging namespace.
For this class I don't see a SetSource method.

Try using

bitmapimage.StreamSource = stream;

instead.

http://msdn.microsoft.com/de-de/library/system.windows.media.imaging.bitmapimage.aspx
Avatar of razza_b

ASKER

I dont seem to see the StreamSource in scope of the bitmapImage.
SOLUTION
Avatar of Vaughn Bigham
Vaughn Bigham
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial