FB_MQTT Line 2 is _LastWillMessageSize := DINT_TO_UINT(2*Stu.StrLenW(ADR(_LastWillMessage)));
This doesn't make sense. _LastWillMessageSize is already set in FB_MQTT.SetLastWill, so you don't need to set it again to twice the length of some random series of bytes before you hit a dword 0x0000 (Pointer to Pointer to a Byte Array which isn't a wstring).
I think line 2 has to go! (also line 1)
fixed