ImageList Epic Fail

Ran into a rather interesting problem today.

Build configurations can wreak havoc on certain programs with different components thrown on them. Especially third party components.

This morning I was tasked with changing the build configuration on all the applications to x86. The task itself is very easy to do if the agents on your build machine are setup properly to build with the selected configuration.

We went through the hoops of setting up the build agents the other day, and everything seemed A-OK. Multiple projects were sent to build and works flawlessly.

Then came “THE ONE” as I shall refer to it. THE ONE has some serious issues, big time bad issues when trying to build outside of the AnyCPU build configuration. Issues so big that even an Undo Pending Changes and Get New couldn’t fix. The build kept failing with the same reason, over and over and over.

An attempt was made to load a program with an incorrect format

I checked all the references, twice. All of them were exactly how they were supposed to be, but this error was damn persistent. Since we couldn’t go back to a previous version this issue had to be solved.

Through the debugger we found that the error was actually occurring the .resx file for the project. After poking around and commenting out some code, we discovered that it was actually and ImageList that was causing all the problems.

After some online sleuthing, it was concluded that the bug was actually from the VS2010 and the .NET framework itself. Our projects all target .NET 2.0, this seems to cause a problem with serialization on the ImageList component. It assumes that you are always using .NET 4.0.

The solution to the problem was easy, we just couldn’t add the component at design time, everything would have to be done dynamically. Presto, it works. Stupid ImageList.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s