Just curious as to how I can get this error the easiest way.
Once I was trying to create a file navigator and I was creating Image thumbnails; that turned out awful.
Just curious as to how I can get this error the easiest way.
Once I was trying to create a file navigator and I was creating Image thumbnails; that turned out awful.
Create a very, very large string. Probably:
string s = new string('a', int.MaxValue);
will be enough.
If not, you can concat it to build even bigger string.
string ss = string.Concat(s, s);
This does throw an OutOfMemoryException:
string s = " ";
while (true) s += s;
Well, it is not the easiest way to get this error, but when dealing with images, it could cause this error, even if there is much memory free:
Confusingly, an OutOfMemoryException is thrown from the System.Drawing.Image.FromFile method when an image format or the pixel format of an image is not supported by the .net framework.
See: http://msdn.microsoft.com/en-gb/library/stf701f5.aspx
I don't know why there is no ImageFormatNotSupportedYetException ;(