You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version
checked 5.0.12, checked 5.0.19, (worked in 3.1.1)
Describe the bug
Creating a new object via BsonValue ctor with an array for the value returns a BsonValue instance with Type=Array and RawValue=["a","b","c"] but usage of AsArray fail with null (returns this as BsonArray which returns null)
Code to Reproduce
var strings = new string[] { "a", "b", "c" };
var bsonValueOfArray = new BsonValue(strings);
Assert.NotNull(bsonValueOfArray.AsArray);
Version
checked 5.0.12, checked 5.0.19, (worked in 3.1.1)
Describe the bug
Creating a new object via BsonValue ctor with an array for the value returns a BsonValue instance with Type=Array and RawValue=["a","b","c"] but usage of AsArray fail with null (returns this as BsonArray which returns null)
Code to Reproduce
Expected behavior
Assert.NotNull(new BsonValue(new string[] { "a", "b", "c" }).AsArray);
to succeedThe problem becomes apparent in the Serialization code, where it sees a BsonValue with Type=Array, calls AsArray and causes a NullReferenceException
Of Note, I uncovered this specifically when using MongoDB.Bson (2.20) as a source:
The text was updated successfully, but these errors were encountered: