§ September 6, 2005

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;
        }
    }
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)

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.1sp1 and deploy it to a machine with out 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?
Posted 20 years, 8 months ago on September 6, 2005

 Comments can be posted in the forums.

© 2003 - 2024 NullFX
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License