Project - Bson NETMF Implementation

Bson NETMF Implementation

Serialization and deserialization implementation of Bson except specs about mongoDB. Some usage snippets here.


Interesting. Thank you.

@ Nickluo Just wanted to say thanks again for this. I had some time over the break to change to using BSON over JSON and the results are orders of magnitude faster to parse using BSON over JSON. I don’t have official stats (will try and get some), but it seems to be well over 10x faster.

There is a couple of changes I needed to make (one bug and one enhancement) - happy to contribute them back again - what is the best way? Post here?

@ Ross, happy to see your performance result. You could post the changed codes here if you like, and I will update it later.

Hi @ Ross, @ Nickluo

Any news about forementioned enhancement to this amazing BSON serializer/deserializer?

Btw, whenever I use Deserialize without type (2nd) parameter, firmware causes emulator to crash…did you experiment same fault?


@ Innovactive
At first, I’ve appreciated your test and feedback. I haven’t got any crash you mentioned yet. The method Deserialize without type parameter should return an object which type is Hashtable. Could you show me your experiment codes? I’ll check it out.


We’ve just rerun our tests and now emulator doesn’t crash anymore: probably it was due to a transient issue due to Agent Smart Watch emulator installation.


P.S. We’ll going on with new tests…


We’ve just spotted an issue.

In InstantiateObject method (in BsonDocument.cs), when info==null and setter method!=null, following code is executed:

set.Invoke(obj, new object[] { InstantiateObject(info.FieldType, table[key] as Hashtable) });

that clearly causes a nullreference exception on info.FieldType.

Since it seems that MethodInfo.GetParameters() is not implemented in .NET MF reflection (nor GetProperty), how could we solve that issue?


We tried serializing following object, but it seems that Array isn’t regularly serialized:

public class Employee
        public string Name;
        public DateTime BirthDate;
        public bool Male;
        public int Level;
        public double Ratio;
        public Employee Boss;
        public Employee[] Subordinates;

Any suggestions?

Actually, it seems that Deserialize() method overload that doesn’t take 2nd parameter (type of entity to be instantiated) works well, and that issues arise from the other method overload.