Open Gabriele91 opened 3 years ago
Update, It is also true for the BOOL type, which is classified as INT32 instead of BOOLEAN: I guess a workaround is a struct krabs::boolean like the krabs::hex32/64 ones.
This is my workaround and it works fine, for me.
namespace krabs
{
struct boolean
{
int value;
};
namespace debug
{
template <>
inline void assert_valid_assignment<boolean>(const std::wstring&, const property_info& info)
{
auto actual = (_TDH_IN_TYPE)info.pEventPropertyInfo_->nonStructType.InType;
if (actual != TDH_INTYPE_BOOLEAN) {
throw std::runtime_error("Requested a boolean value from non-boolean property");
}
}
}
}
Nope, the issue is visible in the first image, the specialized template classifies it as UINT8 instead of boolean (TDH_INTYPE_BOOLEAN). This raises the exception.
@Gabriele91 nice find! #148 added support for boolean including an appropriate assert_valid_assignment
specialization, but it's possible that we missed something. Would you be willing to share a minimal repro that I can test with?
Hi there,
I have a problem regarding parse for boolean type.
Indeed it is identified as UINT8 instead of BOOLEAN (or BOOL), thus throw_if_invalid raises an exception:
I guess it happens because in c++ boolean is an unsigned char instead of int (it is also true for bool). I think could be nice a specialized template for the boolean type, in order to avoid this problem.