[CSHARP-486] Update.SetWrapped throws NullReferenceException when value is null Created: 04/Jun/12 Updated: 02/Apr/15 Resolved: 06/Jun/12 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.4.2 |
| Fix Version/s: | 1.5 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Robert Stam | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Minor Change |
| Description |
|
Passing C# null to Update.SetWrapped<T> should be valid because T is a POCO and not a BsonValue. A C# null value of T will almost certainly be serialized as a BsonNull.Value (although technically it is up to the serializer for T to decide how to serialize C# null). To reproduce:
In 1.4 and later this throws a NullReferenceException. In earlier versions it did not throw a NullReferenceException but it also didn't work. |
| Comments |
| Comment by Robert Stam [ 05/Jun/12 ] |
|
The same applies to AddToSetWrapped, PullWrapped, PushWrapped in addition to SetWrapped. Also, the list of values passed to AddToSetEachWrapped, PullAllWrapped, PushAllWrapped might contain nulls (although the list itself can't be null). |