We "finished" migrating our code to .NET 2.0. We have not deployed it yet, but things are going fine. The VS 2003 to 2005 solution migration was flawless, despite that I have some very tough set up schemes since I had to edit my SLN file manually. The .NET 2.0 compilation did find some interesting stuff. The most stupid was something like
a.Value = a.Value;
Turn out the assigning a value to itself was not caught on C# 1.1, but it is on C# 2.0. Now, here is a few of the issues that we found...
Finalize() method
I have several classes that implement a method Finalize(), which is usually the opposite of the Initialize(), just a harmless method. But C# 2.0 thinks that I'm trying to create a destructor and gives me a warning. Not problem, I just rename all the functions to something like "FinalizeIt()".
FileStream.BeginWrite()
Turn out that I was opening the log file stream not passing the Async flag, but then calling BeginWrite for an async call. That worked fine on .NET 1.1, but on .NET 2.0 the function locks and never returns. Either .NET 1.1 did a synchronous call even if I called BeginWrite, or it ignored the constructor and did async anyway.
String.GetHashCode()
No, you didn't. Yes, I did! I used the GetHashCode value as a checksum on our database. Turn out that you are not suppose to use GetHashCode for anything but short lived run-time structures. The great thing about the Sampa Database engine is that it has a lot of self-healing functionality, so, once it detected some stuff was corrupted, it automatically kicked in a routine to fix as much as it could, and, on this case it could recover 100% of that data. The only real fix here was to replace all the instances of GetHashCode with our own version.