To preface, my code has been working in linux for a while. My next task is to get our program working on windows now.
I have installed manually compiled mongoc (v1.23.5) and mongocxx (v3.7.2), and gotten it building. When i run in debug mode, it works perfectly, but when i run my executable in release mode, it crashes when creating a uri.
in the mongcxx lib, it crashes here:
if (_impl->uri_t == nullptr) {
throw logic_error{error_code::k_invalid_uri, error.message};
}
this is part of:
uri::uri(bsoncxx::string::view_or_value uri_string) {
bson_error_t error;
_impl = stdx::make_unique<impl>(
libmongoc::uri_new_with_error(uri_string.terminated().data(), &error));
if (_impl->uri_t == nullptr) {
throw logic_error{error_code::k_invalid_uri, error.message};
}
}
error.message is ‘invalid utf-8 in uri’
I have absolutely no idea why this is throwing an invalid uri error when it works perfectly fine in debug mode (and on linux). I have verified via debug that the string going into the function is good.
Any help would be appreciated.
After more research, it seems similar to https://www.mongodb.com/community/forums/t/mongo-cxx-driver-r3-6-0-using-std-string-on-mongocxx-uri-leading-to-crash/9582
but not quite the same, and still crashes after setting /MD