Yesterday I got a strange exception:
After backtracking several revisions, I identified the commit that caused the exception for the first time. In this commit, I changed a class in our base project. As it is with many 3-tier-architectures, we have a client and a server project that use a common base project. Changes in this base project have to be reflected both on the server and the client. When I got the error, I was connecting to a remote server than ran an older version of the code. Hence this server could not know about my changes in the base project. The solution was to start a local server that knew about my change.
This is just a small note - however it would have saved me a lot of time searching for the cause of the problem.
TL;DR
If running in an InvalidClassException, think about your architecture: Is a component of your system using another version of your codebase?