Serialization versus portabilityMarch 8, 2006 at 11:29 am | Posted in C#, GIMP, Programming | 3 Comments
While writing a GIMP# plug-in that can read Paint.NET files we stumbled upon an ugly problem: the Paint.NET developers thought it would be a good idea to use the built-in (binary) serialization features of .NET to save their image files. Of course this is plain stupid for a number of reasons: firstly it will make importing of this file format very difficult for other programs simply because there is no documented file format. Secondly, this leads to portability problems since we can’t know for sure what fields are exactly serialized. It happens that .NET 2.0 serializes a few private member variables that are of course not found when we try to deserialize this stuff with Mono😦 So now we have a GIMP# plug-in that can read Paint.NET files on windows and not on Linux. Sigh.
Conclusion: never ever use binary serialization if you want your files to be used by other programs or on another platform.