System.ArgumentException: Parameter is not valid

Ask general questions here.
mtkilic
Posts: 9
Joined: Tue Jan 15, 2019 4:12 pm

System.ArgumentException: Parameter is not valid

Post by mtkilic » Thu Apr 11, 2019 5:18 pm

I am getting below error when I run ranorex test. I am not sure why its giving me this error. I use same function in mutliple places and it works just fine.

Code: Select all

isImage=cl.RGBImageValidation(repo.CDIS.ScenarioEditorPanel.Canvas,Screenshot+"Setup_RGB.png",ScreenCaptureMode,0.99999);

Code: Select all

Exception occurredSystem.ArgumentException: Parameter is not valid.
 at System.Drawing.Bitmap..ctor(String filename)
 at CDIS_V11.FunctionalLibrary.CL.ImageValidation(Element item, String test1, String test2, Double options) in d:\ranorex\utilities\qa\ranorex\V22\CDIS_V21\Functional Library\CL.cs:line 256 
Line 256 code:

Code: Select all

bool isCreated= Validate.CompareImage(item,new Bitmap(test1),MyFindOptions,"test",options1);

ahoisl
Certified Professional
Certified Professional
Posts: 192
Joined: Fri Sep 07, 2007 8:16 am

Re: System.ArgumentException: Parameter is not valid

Post by ahoisl » Thu Apr 11, 2019 7:12 pm

The .NET Framework and the underlying native GDI+ imaging API is not always really helpful with their error messages when using Bitmaps. The error message you get could mean that the file could not be loaded (maybe because it was not found) or even that the process/machine is out of memory.

See my answer in your other thread on what you can do to stabilize your image handling code:
viewtopic.php?f=4&t=13721&p=53906#p53906

Regards,
Alex
Ranorex Team