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(stre am);
Ive used jpg, png, gif all same outcome, im returning data from a SL enabled WCF
SNIPPET
using (ms = new MemoryStream(response.Docu ments[0].D ata))
{
arr = new byte[ms.Length];
return arr;
}
void viewLabelCompleted(object sender, viewLabelCompletedEventArg s 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(stre am);
image1.Source = bitmapimage;
}
}
}
catch(Exception ex)
{
throw ex;
}
it falls over at line of code - bitmapimage.SetSource(stre
Ive used jpg, png, gif all same outcome, im returning data from a SL enabled WCF
SNIPPET
using (ms = new MemoryStream(response.Docu
{
arr = new byte[ms.Length];
return arr;
}
void viewLabelCompleted(object sender, viewLabelCompletedEventArg
{
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(stre
image1.Source = bitmapimage;
}
}
}
catch(Exception ex)
{
throw ex;
}
ASKER
Im using silverlight 4 BitmapImage class, its in th eSystems.Window.Media.Imag ing 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
Try using
bitmapimage.StreamSource = stream;
instead.
http://msdn.microsoft.com/de-de/library/system.windows.media.imaging.bitmapimage.aspx
ASKER
I dont seem to see the StreamSource in scope of the bitmapImage.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It appears that the comment:
https://www.experts-exchange.com/questions/27222160/catastrophic-failure-exception-from-hresult-0x8000ffff-e-unexpected.html?anchorAnswerId=36391593#a36391593
Resolved the issue due to an issue with an empty byte array as indicated in the author comment:
https://www.experts-exchange.com/questions/27222160/catastrophic-failure-exception-from-hresult-0x8000ffff-e-unexpected.html?anchorAnswerId=36392846#a36392846
https://www.experts-exchange.com/questions/27222160/catastrophic-failure-exception-from-hresult-0x8000ffff-e-unexpected.html?anchorAnswerId=36391593#a36391593
Resolved the issue due to an issue with an empty byte array as indicated in the author comment:
https://www.experts-exchange.com/questions/27222160/catastrophic-failure-exception-from-hresult-0x8000ffff-e-unexpected.html?anchorAnswerId=36392846#a36392846
I only found a BitmapImage class that has a StreamSource property but no method SetSource().