views:

157

answers:

2

It appears that cloning a Image and converting it to a byte array is causing EDIT.COM to open up on Windows XP machines. This does not happen on a Windows 7 machine. The application is a C# .NET 2.0 application. Does anyone have any idea why this may be happening?

Here is my Image conversion code:

        public static byte[] CovertImageToByteArray(Image imageToConvert)
    {
        imageToConvert.Clone() as Image;

        if(clone == null)
            return null;

        imageToConvert.Dispose();

        byte[] imageByteArray;
        using (MemoryStream ms = new MemoryStream())
        {
            clone.Save(ms, clone.RawFormat);
            imageByteArray = ms.ToArray();
        }

        return imageByteArray;
    }


    public static Image ConvertByteArrayToImage(byte[] imageByteArray,
                                                ImageFormat formatOfImage)
    {
        Image image;

        using (
            MemoryStream ms = new MemoryStream(imageByteArray, 0,
                                               imageByteArray.Length))
        {
            ms.Write(imageByteArray, 0, imageByteArray.Length);
            image = Image.FromStream(ms, true);
        }

        return image;
    }

Thanks

Justin

+1  A: 

It's hard to help without guessing here, so here we go:

Somewhere in your code you or an external library relies on/calls an external tool, called "edit.exe". Maybe, god forbid, even something triggered in the database. The programmer didn't care about the extension, wrote "edit foo.bar" in the Process.StartInfo. Because of your PATH and the order of resolution (com before exe) this ends up calling edit.com on machines that come with it.

Well - this is really nothing but an artificial story, but I cannot imagine a way of launching any app with the code you've given. Try to be sure about the exact place where this happens. I doubt that it is the conversion/the code you showed.

Benjamin Podszun
This is the exactly the type of answer i was looking for. Thank you.
JayDial
A: 

After a lot of digging it turns out to be something strange going on with a HyperLinkEdit from DevExpress. The Text value was set to "Edit". I renamed it to "Edet" and the issue went away. I will be reporting this to DevExpress for further evaluation.

Thanks everyone,

Justin

JayDial
OMG smells bad code indeed. Shame on DevExpress.
Camilo Martin