Stupid .NET 1.1 Service Pack 1

Service pack 1 strikes again.

    using System;
    using System.Drawing;
    using System.IO;
    using System.Reflection;
    public class Resources {
        private Resources() {}
        public static Image LoadImageFromResource(string path) {
            Image i = null;
            using ( Stream s = 
                      Assembly.GetExecutingAssembly().GetManifestResourceStream(path) ) {
                if(s != null) i = Image.FromStream(s, true, true);
            }
            return i;
        }
    }
C#

This is part of a general use utility that I frequently use. An odd bug that came out of this is that the overloaded method

Image.FromStream(Stream, Boolean, Boolean);
C#



was added in Service Pack 1 for .net v1.1 BUT NEVER DOCUMENTED!!!. Well, ok that’s not entirely true It is documented… in v2.0 documentation. So if you wrote this in 1.1 sp1 and deployed it to a machine without sp1 you’ll get a method not found exception when trying to load the image from stream using the above overload–non sp1 only has FromStream(Stream, Boolean)

Nothing like being incompatible with the same version of the framework eh?