Serialization of bodies with userdata

When i start the Farseer Serialization it throws an exception 'Sideshooter.Weapon cannot be serialized because it does not have a parameterless constructor', I think it is having problems serializing bodies where the userdata is a GameObject.

I convert these objects to classes that do not inherit from GameObject so I can give them a 'parameterless constructor' and this error goes away. However in my game how would I go about saving the state of the running game if I can't use the Farseer serialization,
apart from writing my own serializer which is daunting.

Like Richard said: Farseer can't do much more than throw your custom user data objects at the serializer. Therefore they of course have to be serializable. That is a c# problem however, not really related to Farseer. An easy solution would be to use Farseers
userdata fields just for primitive datatypes (as those have default serializers) e.g. integers which are just an index into some list which holds your actual game data. That still leaves you with the problem of how to restore your actual game data at some
point.

The proper way to do it (and if you want to implement some kind of save feature you have to serialize your whole game state anyway at some point) is to (as has already been pointed out) tag your classes with the [Serializable] attribute
and to make them implement the ISerializable interface. You can find plenty of information regarding the finer details of how and what to serialize in c# on msdn.

Thanks for the replies, in my ignorance I was expecting Farseer serialization to wave a magic wand and serialize everything for me - GameComponents and all. I'll have look into it properly now - and go back to the drawing board again :)

One other question though, if I serialize/deserialize Farseer bodies do they keep the same 'BodyId'?

[EDIT] I can serialize my world now but when I deserialize it a new world is created... how do I then reference my new world? Also do I have to clear my old world?

Problem isn't fixed. After using world.Clear() and then deserializing I find that body ids in the new world are not the same as when I first generated them, so breaking all the links between my objects. The new body ids are offset by the total amount of
bodies in the world prior to serializing, so 4 bodies with ids 0-3 before serializing and after desirialzing I have ids 4-7.

I tried to simplify my Serialize and then deserialize as much as I could to debug. I start with a new world and add a single body with simple userdata which I can see using the debug view. I serialize but then the deserialize and the game freezes. I'm
very confused as to where the problem is, here is my serialized world that fails to desirialize:-

I'm very reluctant to try and read the xml and create bodies using my own methods as I expect that will be a world of pain. Please could someone help or suggest another method of saving the Farseer world and reading it in again.