It is very difficult to Java developers to write C# code. Not because of the language – they are pretty much the same. But it turns out you make basic assumptions which are just not true.
We develop C# code that access services deployed in WebSphere ESB and send messages in WebSphereMQ. The sender creates a message identifier, that consists of the sender id, object type and more. The listener creates the same identifier, and listens to the queue with this identifier.
Suddenly – the identifier the listener and the sender create is different.
Turns out that the problem lies in the fact that the sender is a 32bit machine, and the listener runs on a 64bit machine.
Why is that a problem? Because in .net, code is not cross platform – not even between Windows environments – since the GetHashCode() function of String is not cross platform – and works differently on 32bit and 64bit machines.
Anyway, we wrote our own Hash function, that simply copies the java.lang.String hash() function (every JDK comes with src.zip, where you can find the java.lang.String code).
3 hours of my life wasted…