I've been using Visual Studio 2010, C#.
I've been working on this program for almost a year now. In it, I'm using information stored in separate XML files to build images. This process has worked for me hundreds of times without a problem.
I have migrated to a new machine. The previous machine was 32 bit, the new one is 64 bit. When I open a file and attempt to deserialize, the following exception is thrown:
System.InvalidCastException was unhandled Message=[A]System.Collections.Generic.List
1[BookCreator.pageFontInfo] cannot be cast to [B]System.Collections.Generic.List
1[BookCreator.pageFontInfo]. Type A originates from 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in the context 'LoadNeither' at location 'C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Type B originates from 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in the context 'LoadNeither' at location 'C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'.
Here is the code that generates the error:
List<pageFontInfo> info;
XmlSerializer serializer = new XmlSerializer(typeof(List<pageFontInfo>));
TextReader tr = new StreamReader(openFile);
info = (List<pageFontInfo>)serializer.Deserialize(tr); <---error thrown
pageFontInfo is a custom built Serializable struct. It contains two strings, a float, and a list of points. I have no idea what is going wrong. I've compared the two "originations" of the lists, and they are identical. I'm totally stumped. This has worked hundreds of times in the past before the migration.
Edit: I just checked. I've run both the compiled .exe and source code on another machine that was 64 bit. So whatever is going wrong now does not have anything to do with that. It's specific to this installation of Visual Studio 2010.