Message: Unhandled Error in Silverlight 2 Application Code: 4004 Category: ManagedRuntimeError Message: System.NotSupportedException: Unsupported color model... at C1.Silverlight.Imaging.JpgCodec.DecodeInternal(C1Bitmap bmp, Stream stream) at C1.Silverlight.Imaging.JpgCodec.Decode(C1Bitmap bmp, Stream stream) at C1.Silverlight.Imaging.C1Bitmap.SetStream(Stream stream) at C1.Silverlight.Imaging.C1GifImage.SetSource(Stream stream) at C1.Silverlight.Imaging.C1GifImage.wc_OpenReadCompleted(Object sender, OpenReadCompletedEventArgs e) at System.Net.WebClient.OnOpenReadCompleted(OpenReadCompletedEventArgs e) at System.Net.WebClient.OpenReadOperationCompleted(Object arg)
Thanks, Brent
The current Jpeg decoder (we use the one from fjcore) doesn't support grayscale and cmyk color models. We had this on our todo list, but never got around to it because it had low priority (no customer had asked for it). Now with SL3 we might not need to improve the decoder, it's possible to decode a JPEG using WriteableBitmap, so we might just do that.
Can you post the image you were trying to decode? It would help us with testing.
bbonet:Unfortunately it seems there is not an equivalent event dispatched by the C1Image component. Does anyone know how I can at least handle/trap this error using C1?
One of the main issues I've had using the C1 Imaging components is that they do not match the MS component object structure.
For example, I'm able to use the Image.ImageFailed event to catch any load errors, but the C1Image component does not have an ImageFailed event.
Also the Image.DownloadProgress event has a signature of void Image_DownloadProgress(object sender, DownloadProgressEventArgs e). The C1Image.DownloadProgress event uses the DownloadProgressChangedEventArgs. With those args MS uses DownloadProgressEventArgs.Progress and the DownloadProgressChangedEventArgs uses a ProgressPercentage property.
This all makes my life difficult.
Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618; MS-RTC LM 8; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; eMusic DLM/4) Timestamp: Wed, 27 May 2009 23:22:34 UTC Message: Unhandled Error in Silverlight 2 Application Code: 4004 Category: ManagedRuntimeError Message: System.BadImageFormatException: Unknown block type. at C1.Silverlight.Imaging.GifCodec.DecodeInternal(C1Bitmap bmp, Stream stream) at C1.Silverlight.Imaging.GifCodec.Decode(C1Bitmap bmp, Stream stream) at C1.Silverlight.Imaging.C1Bitmap.SetStream(Stream stream) at C1.Silverlight.Imaging.C1GifImage.SetSource(Stream stream) at C1.Silverlight.Imaging.C1GifImage.wc_OpenReadCompleted(Object sender, OpenReadCompletedEventArgs e) at System.Net.WebClient.OnOpenReadCompleted(OpenReadCompletedEventArgs e) at System.Net.WebClient.OpenReadOperationCompleted(Object arg) Line: 53 Char: 13 Code: 0 URI: http://localhost/PBPhotoBrowser.Web/PBPhotoBrowserTestPage.html
It's looking like there are some errors that are occurring while decoding. Invalid images are fine and dandy but I REALLY need to be able to trap these errors so my app doesn't randomly crash. Can you help me with this? Thanks, Brent