Search code examples
c#winformsvisual-studio-2010imagelist

Compile error RG0000 ("incorrect format") after adding images to an ImageList


In the project I'm working on, there is a certain form that contains an ImageList control. Up until a few days ago, everything was working fine, and there were 5 images in the control.

Then one of my co-workers added a 6th image to the control. I got latest version from source control, and suddenly my project would not compile anymore. Error message:

error RG0000: Could not load file or assembly 'file:///D:/MyProjectPath/Bin/Debug/SomeOther.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.

This error message is obviously bogus. There is no connection whatsoever between the ImageList control and SomeOther.dll. When I reverted the changes my colleague made, the project compiled fine again. But if I tried just to remove the one image he added, it still gives the compiler error. In fact, if I remove all the images, then add a new one myself, it still throws the error. Only if I remove all images from the ImageList will it compile!

Something is really not cool here. To summarize:

  • The old code in source control compiles fine, with 5 images in the ImageControl.
  • If anyone (myself included) adds a new image, it doesn't compile.
  • Even after removing the new image, the project does not compile. A file diff between the resx files reveals that one or two characters in the whole long "imageList.ImageStream" encrypted string have been changed. The project does not recompile until those characters have been reverted to their old value.
  • This problem only exists in my dev environment. Every other developer has no trouble at all.

Any ideas?


Solution

  • Solution found here. It's a known bug at Microsoft since may 2010, and they have still not released a patch. Have to use the workaround suggested there. What a PAIN!