Save GenericResource #6

codebude opened this Issue Aug 28, 2012 · 1 comment


None yet

2 participants



I try to change a .png-File in a ressource. I'm really sure, that the choosen ressource is a correct png resource. I also exported the resource. All ok. But wenn I change the data with some other .png data, it crashes with an Win32 Exception. (Translated from german to english it means something like "This requirement/request is not supported.")

It crashs at the last line (saveTo()) from my example.

filename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "imageres.dll");

using (ResourceInfo vi = new ResourceInfo())

        //Take a png resource
                GenericResource res = (vi.Resources[vi.ResourceTypes[2]][14] as GenericResource);

                Image imageIn = Image.FromFile(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "import.png"));
                MemoryStream ms = new MemoryStream();
                imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                res.Data = ms.ToArray();

        //Win32 Exception. Why?
                res.SaveTo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "imageres.dll"));



Did you ever solve this? Ca you post the entire stack please and maybe write this repro as a unit test within the project? Thx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment