The bottom line is that I need to call C++/CLI library functions that will access and interact with a C# program.
The drop occurs only if the C++ function accesses classes from the C# library. If you remove them and leave only the C++ code, the expert Advisor works fine and the function is called properly.
The problem is most likely related to the terminal, because I tested function calls using another C++ project and no errors occurred. Tried also DllExport directly from C#, but that doesn’t work either.
Binaries, script and project code are attached. If you suggest another more convenient way to interact with the terminal, I will be happy. It is a two-way data exchange that is required.