File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
MongoDB.BsonUnitTests/Serialization
MongoDB.Bson/Serialization Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -334,7 +334,7 @@ public BsonMemberMap Reset()
334
334
/// <summary>
335
335
/// Sets the default value creator.
336
336
/// </summary>
337
- /// <param name="defaultValueCreator">The default value creator.</param>
337
+ /// <param name="defaultValueCreator">The default value creator (note: the supplied delegate must be thread safe) .</param>
338
338
/// <returns>The member map.</returns>
339
339
public BsonMemberMap SetDefaultValue ( Func < object > defaultValueCreator )
340
340
{
Original file line number Diff line number Diff line change @@ -48,6 +48,17 @@ public void TestEachDefaultValueIsNewInstance()
48
48
Assert . AreNotSame ( c . L , d . L ) ;
49
49
}
50
50
51
+ [ Test ]
52
+ public void TestModifyingEmptyListDoesNotCorruptDefaultValue ( )
53
+ {
54
+ var json = "{ _id : 1 }" ;
55
+ var c1 = BsonSerializer . Deserialize < C > ( json ) ;
56
+ c1 . L . Add ( 1 ) ;
57
+ var c2 = BsonSerializer . Deserialize < C > ( json ) ;
58
+ Assert . AreEqual ( 1 , c1 . L . Count ) ;
59
+ Assert . AreEqual ( 0 , c2 . L . Count ) ;
60
+ }
61
+
51
62
[ Test ]
52
63
public void TestValueMissing ( )
53
64
{
You can’t perform that action at this time.
0 commit comments