The FromFile Exception name quiz - answer

In a previous post I asked what exception System.Image.FromFile() threw if you passed it a file that is not actually a supported image format. The answer?

Well, it's not 'UnsupportedImageFormatException', that's for sure. It's not even 'ArgumentException'. No, the answer is, it throws an 'OutOfMemoryException'.

Seriously. Look it up.

In the course of investigating this bizarre API decision, I also discovered that the .NET framework contains a subclass of OutOfMemoryException called an InsufficientMemoryException. Presumably so that you can distinguish between those circumstances when you have sufficient memory, but nonetheless have run out of memory...

Print | posted on Monday, September 25, 2006 10:06 AM

Comments on this post

No comments posted yet.

Your comment:

 (will show your gravatar)
 
Please add 6 and 5 and type the answer here: