what could be the cause of this error?

  • Thread starter Thread starter dawn
  • Start date Start date
D

dawn

Hi,

I have written a bot-like program, which basically does the same thing over
and over again, only using different parameters. Everything goes fine, until
after an hour or three, the application stops and signals a
'System.ArgumentException'

When I run the debugger on the running ap it shows that the error is caused
in system.drawing.dll and it tells me "invalid parameter".
What could be the cause of this......every time I let the program run, it
works fine uptill around the same time....although in no two runs of the
program the paramaters that are handled are the same.
don't have a clue what to do with this.

Thanks for ne advice.
 
100,

Actually I'm not drawing myself, but i am doing some extensive pixel
comparisons (in unsafe code)....and it does sometimes throw an out of memory
error....well it did the first few times, now i always get the invalid
parameter option.
 
Hi dawn,
If you do some drawing I have found that Graphics class trows very strange
exceptions in some cases. Ususally it happened to me when I use hatched
brushes or dashed pens. What I found is that when you use for example dash
pen with offset of the dashes you cannot draw a line, which is shorter than
the offset. As far as I remember in this case out-of-memory exception is
thrown (?!?)
The same for hatched brushes. I got the same strange exception when trying
to fill very tiny areas.
Indeed the Graphics objects throws strange exceptions some times.
However, check if you don't have two or more points with the same X and Y in
a row. In combination with some types of pens or brushes it might throw an
exception.

It will throw ArgumentException of course if you try to draw line(s) or
polygon or fill a polygon and you specify only one point.

B\rgds
100
 
Back
Top