-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Labels
platform: visual studiorelated to MSVCrelated to MSVCsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
Description
So parse seem to work fine, if I load dll from my tester project, everything works fine, if I load exactly same dll with same data through windows services I get lots of errors like "Unhandled exception at 0x75000132 in xxxxxxx.exe: Microsoft C++ exception: nlohmann::detail::parse_error at memory location 0x0293A868. occurred"
This is triggered by
bool parse_error(std::size_t, const std::string&,
const detail::exception& ex) override
{
errored = true;
if (allow_exceptions)
{
// determine the proper exception type from the id
switch ((ex.id / 100) % 100)
{
case 1:
JSON_THROW(*reinterpret_cast<const detail::parse_error*>(&ex));
case 2:
JSON_THROW(*reinterpret_cast<const detail::invalid_iterator*>(&ex)); // LCOV_EXCL_LINE
case 3:
JSON_THROW(*reinterpret_cast<const detail::type_error*>(&ex)); // LCOV_EXCL_LINE
case 4:
JSON_THROW(*reinterpret_cast<const detail::out_of_range*>(&ex));
case 5:
JSON_THROW(*reinterpret_cast<const detail::other_error*>(&ex)); // LCOV_EXCL_LINE
default:
assert(false); // LCOV_EXCL_LINE
}
}
return false;
}
at line 3624 of json.hpp, I am using hardcoded data defined right in dll at this moment, to rule out any memory issues, but it's not helping. It just dies when it's trying to parse std::wstring.
static int SendToAgent(std::wstring & data, LPCWSTR LogType)
{
if (mqttHandlerGlobal.IsAgentOnline())
{
//_asm {int 3}
auto string = std::wstring(LogType);
auto datatype = nlohmann::json::parse(string);
auto parsedData = nlohmann::json::parse(data);
nlohmann::json messageJson =
{
{ "DataType", datatype },
{ "Data", parsedData },
};
printf("Message Sent\n");
auto message = messageJson.dump();
return mqttHandlerGlobal.MqttSend(message, *mqttHandlerGlobal.GetTopic());
}
return 0;
}
called by
std::wstring test = L"Test";
SendToAgent(test, L"TestType");
I've really got no clue what's causing it, apart that DLL with parsing code is being loaded by a different project that runs under windows service its exactly the same.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
platform: visual studiorelated to MSVCrelated to MSVCsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation