Bson Serializer throws an exception when serializing a null property that is an interface

34 views
Skip to first unread message

Justin Dearing

unread,
Sep 23, 2012, 3:01:51 PM9/23/12
to mongodb...@googlegroups.com
A complete example of the failure is here:

Basically lets assume that AProp is property of type IProp, and IProp is an interface:

                var superClass1 = new SuperClass
                {
                    Name = Guid.NewGuid().ToString(),
                    AProp = null
                }

No incantation of BsonSerializer.LookupSerializer(); will fix this. Should there be some sort of "NullSerializer" to handle this? Should it just use BsonNullSerializer? Is there a need for a specialized BsonNullInterfacePropertySerializer?

If you don't feel this is by design, I'll file a bug an write a unit test.

Justin

Justin Dearing

unread,
Sep 23, 2012, 3:35:16 PM9/23/12
to mongodb...@googlegroups.com
Apparently this has been fixed post 1.6 release. Disregard.

craiggwilson

unread,
Sep 23, 2012, 3:42:23 PM9/23/12
to mongodb...@googlegroups.com
What is it that you were expecting a problem with?  What does 1.6 do that has been fixed?

craiggwilson

unread,
Sep 23, 2012, 3:45:41 PM9/23/12
to mongodb...@googlegroups.com
I see.  Yes, here is the commit:  https://github.com/mongodb/mongo-csharp-driver/commit/98a01290ffd0ae4e46aa5f96a5b4acce4bc6a5a1  and the original jira was 564.
Reply all
Reply to author
Forward
0 new messages