I have some code that does something like this (Irrelevant bits snipped):
void foo(Bitmap bmp1, Bitmap bmp2)
{
Bitmap bmp3;
if(something)
bmp3 = new Bitmap(bmp1.Width, bmp1.Height + bmp2.Height);
else
bmp3 = new Bitmap(bmp1.Width, 18000);
(more stuff here that runs fine)
}
Anywho most of the time this ran fine. At first. As the project continued it started to fail on the new Bitmap line. The error it gives is: "ArgumentException was unhandled. Parameter is not valid." There's no mention of which parameter it has a problem with or anything. I'm stumped. Here's what I know for sure:
- bmp1 and bmp2 have never been null when this error is thrown.
- The if statement's presence has never made a difference; it dies just as frequently without.
- Both examples of the constructor use have thrown this error.
I'm tempted to say this is a memory error, except it doesn't mention anything of the sort. The first dozen times or so this happened the heights totalled over 18000 (hence the magic number above). Figuring it was some kind of soft barrier to our system, we just limited the images at that height which made the exceptions go away after a while.
For some sample data, the exception I'm looking at right now has bmp1.Width at 2550, bmp1.Height at 6135 and bmp2.Height at 6285.
Anyone have any ideas?