1

How can i serialize Nullable types with protobuf.net? This post tries to explain a few approaches: Can I serialize arbitrary types with protobuf-net?

The problem is that there seems to be a bug with the surrogate approach in relation to Nullable, which is also mentioned in the linked post. The shim property approach is not suitable for us, mainly because we have many properties of this type.

We are very keen on relying on protobuf.net for serialization as it matches our need for compact and fast serialization, but it is difficult due to this issue.

Community
  • 1
  • 1
hjalet
  • 13
  • 2

1 Answers1

2

A picture says a thousand words...

enter image description here

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • Well, that was fast! Thank you. I tried to check out the source code using: svn checkout http://protobuf-net.googlecode.com/svn/trunk/ protobuf-net-read-only. But got an error saying unable to connect to a repository at URL..... Any ideas? – hjalet Jul 11 '12 at 06:37
  • Is it possible for you to provide a build and make it available on the download page on the project site? I tried to check out the code but is is unable to build due to a lot of dependencies not being present. – hjalet Jul 12 '12 at 07:07
  • @hjalet the only thing you need to build is the "protobuf-net" project, under "Core" in the .sln; do you want to try just building that one before I get a clean clone of the trunk? (my working folder has changes, and although it should be stable, I'm not really at a logical "release" point, unless people need specific features) – Marc Gravell Jul 12 '12 at 07:19
  • Ok. I had one compiler error in that project, since it does not allow implicitly typed variables. After i changed line 559 in CompilerContext.cs from 'using (**var** loc = GetLocalWithValue(type, valueFrom))' to 'using (**Local** loc = GetLocalWithValue(type, valueFrom))' it compiled. Thanks. – hjalet Jul 12 '12 at 08:24
  • @hjalet you're a few versions behind, then ;p Sorry about that, but that was fixed already – Marc Gravell Jul 12 '12 at 13:20