1

I am trying to use protobuf-net precompile tool from the latest release (r622) and I was wondering how to handle types that I can't decorate with ProtoContract attributes.

More specifically, when the precompile tool process custom types aggregating XNA members (Vector3, Matrix, etc...) I get the following expected error:

No serializer defined for type: Microsoft.Xna.Framework.Vector3

Since I can't add attributes to those types, what is the recommended way to deal with this ? Should I revert back to the old way of having my own precompile tool creating and compiling a custom TypeModel ?

Philippe
  • 67
  • 5
  • Excellent question, and I'm open to suggestions. In particular, when compiling *properly* for cross-platform, I'm only opening the assemblies for *inspection*, so I can't use runnable code (a static method etc) in the assembly. I'm wondering whether doing something like a script-based file (iron python or lua or something), or whether to just use some kind of basic config file (JSON for example). – Marc Gravell Jan 31 '13 at 21:38
  • @MarcGravell Having some sort of config file is something that first came to mind as well. All you should need is the fully qualified type name and a list of strings to explicitly declare all the fields. The problem i can see with this is that it might only be a temporary workaround for simple types. Instead of having an executable that has to deal with every single platform, why not simply provide a simplified API that we can use in our own serialization assembly generation tool – Philippe Jan 31 '13 at 22:35
  • @Phillippe well, RuntimeTypeModel / MetaType is exactly that API at the current time. But I could simplify some of the IKVM loader code, perhaps. Writing your own compiler against the IKVM build (for full cross-target compile) is not as easy as it could be. – Marc Gravell Jan 31 '13 at 23:05
  • 1
    @MarcGravell Thank you for the info ! I decided to go the route of [proxy types and implicit operators](http://stackoverflow.com/q/8901287/1886241) to make the conversion easy. – Philippe Feb 01 '13 at 06:53

0 Answers0