-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Since moving from the nuget package to the new format for 2.10, I am now getting memory errors at run time when trying to declare any variable from the cpprestsdk. My project is being built in the unicode characterset and using visual studio 2017.
Here is a sample function. When I step through the program at runtime all the variables are showing the correct information. If i comment out the json portion as a test and go straight to the call, it fails with same errors.
//Login call
http_response ThreadRest::FutureLogin(RestInfo info) {
//Declare variables
http_response loginResponse;
json::value j_login;
j_login[L"username"] = json::value::string(userName); //string_t variable <--crash here with error: std::bad_alloc at memory location 0x0000002BEACFC1D0
j_login[L"password"] = json::value::string(password, true);
j_login[L"connectionNumber"] = json::value::number(info.connection); //int variable
utility::string_t uri = L"auth/CyberArk/CyberArkAuthenticationService.svc/Logon";
//Setup the connection
http_client client(info.serverName); <-- Crash here if commenting out json with error: web::uri_exception at memory location 0x000000E46C1FC950
http_request request(methods::POST);
request.set_body(j_login.serialize().c_str());
request.headers().set_content_type(contentType);
request.set_request_uri(uri);
client.request(request).then([&](http_response response) {
loginResponse = response;
std::wcout << response.status_code() << "\n";
}).wait();
return loginResponse;
}
I am not sure what changed when I moved from the nuget version 2.9.1 to 2.10
Metadata
Metadata
Assignees
Labels
No labels