We're in the process of adding Swift 5 support for our libbson binding in the MongoDB Swift driver, and I've run into a strange issue. Since bson_t
is now imported as an opaque type, I had to add an accessor for that value in our bindings to libbson. What's happening now is that when I first compile and run our tests, that value will return a value of 1 until I modify the calling function in some way (add a print statement, move a line). Once I modify that function, it will correctly return the length of the bson_t
and everything works as expected.
I've been able to confirm that the helper function is correctly reporting the value of the passed in bson_t
, so it seems like the bson_t
being passed in is invalid for some reason. Any ideas what might cause this behavior?