This is a migrated thread and some comments may be shown as answers.

Parameter is NOT valid. Check image is good before displaying

3 Answers 630 Views
BinaryImage
This is a migrated thread and some comments may be shown as answers.
Sameers
Top achievements
Rank 1
Sameers asked on 04 Feb 2011, 08:46 AM
Hi,
    Recently, I found an issue that when an image is corrupted, and we try to assign it to RadBinaryImage, we get error "Parameter is not valid". Thats OutOfMemory exception, seems .NET can't load image properly then. However, this cause ASP.NET application to throw an "unhandled" exception.

   I wonder, if it was possible for telerik component to validate the image as it was assigned to it (like DataValue property) and throw an exception to indicate that assigned value is NOT a valid image. Currently, I have to load image, and if loads successfully, then I use my routine to convert the image to bytes and assign to DataValue property. 

   Though I see many threads on this topic "Parameter is not valid", as per I know, its "mysterious" ASP.net message and most of the time, caused by OutOfMemory exception. I wonder if this "check of validity of image" should be implemented in other controls of telerik, like reporting etc.

   Thanks,
   Sameers

3 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 09 Feb 2011, 12:00 PM
Hello Sameers,

Please examine the Validate image from file in C# forum thread to see how to check whether a stream is a valid image file.

I hope this helps.

Greetings,
Mira
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Sameers
Top achievements
Rank 1
answered on 09 Feb 2011, 12:12 PM
I already knew the issue and that how to solve it. the purpose of the post was to give a "suggestion" for telerik products to "validate" image and if found invalid, either continue or throw a proper message (or display default image)!

thanks,
Sameers
0
Mira
Telerik team
answered on 11 Feb 2011, 04:04 PM
Hello Sameers,

Thank you for your feature request.

I will forward it to our developers team and they will consider implementing it in future versions of RadControls for ASP.NET AJAX.

Regards,
Mira
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
BinaryImage
Asked by
Sameers
Top achievements
Rank 1
Answers by
Mira
Telerik team
Sameers
Top achievements
Rank 1
Share this question
or