Hey Evgeniy,
We got your email about this, but we haven't had time to reproduce it on a macOS system. After Microsoft dropped support for Visual Studio on macOS, we haven't yet set up Visual Studio Code with all the necessary dependencies so we can test this.
In short everything with extra data work fine in “native languages” (like C/C++/etc.) on macOS.
It's something in the C# layer that's messing things up on macOS. We'll investigate and get back to you when we've figured it out.
Just guessing based on how Microsoft does unicode (UTF-16 🤮) and how the rest of the sane-world does unicode (UTF-8), Microsoft's .NET is passing your string as UTF-16 despite the PINVOKE specifically saying *not* to do that (pass as raw characters).
Of course we have to confirm this and then figure out how to work around Microsoft's many bugs in an unobtrusive way.