I'm making great progress with converting a major Swing application to J#. I've run into a number of incompatibilities, but I've generally been able to resolve these satisfactorily with a moderate amount of work. The application is looking pretty good running under .Net.
One problem I haven't been able to resolve is that this application stores serialized objects into files. I know this isn't a recommended practice, but it's what I have to deal with. I've tested serializing and deserializing these same objects using J#, so I know there is nothing fundamentally wrong with the serialization of the objects. I also know there is nothing fundamentally wrong with the file format, because base classes such as String are deserialized ok.
Also, I'm familiar with the issues regarding the serialVersionUID, and the likely incompatibilities between compilers that can arise if the defaults are used. In this case, all of the objects have specific serialVersionUID's set. It may be worth noting that in all cases it is set to 0, also not a good practice, but it seemed to work ok for the JDK. I mention this because it could possibly have some affect on the result.
The symptom that I'm seeing is that when I call ObjectInputStream.readObject, it returns a result without throwing a ClassNotFound exception. But the object that is returned is of the class ObjectStreamClass, not of the class that was originally serialized. The debugger reports it as being of the class that was serialized, but if I try to cast it to that class I get a casting exception. The forClass method of the object returns the class that was originally serialized as well.
My guess is that in spite of the fact that the deserialization code seems to know what class to use to deserialize the object, ot won't do that for some reason, and that the default behavior is to return an ObjectStreamClass object instead of throwing an exception. A further clue on this is that if I add a readObject method to the serialized class, it gets invoked in my test code (where I am both serializing and deserializing the object in J#), but not in the application code (where the object was serialized with the JDK and deserialized with J#).
I realize this is a rather complex issue, and I've reviewed the other postings related to it to no avail. It's frustrating that the compiler seems to know what class to use for the deserialization but doesn't do it for some reason.
Ram

Deserializing objects serialized with JDK
AKFox
Hi,
I agree it seems to be a complex issue, but its too difficult for me to point out the exact issue unless you can send me some code which reproduces this problem. Only thing i can suggest right now is you try with specific serialVersionUID and see if that helps you.
thanks
Prem