The latest release of cTrader 4.2 now uses Microsoft NET 6 and is a multi-threaded trading platform and many 3rd party indicators and cBots written by programmers were previously not written thread-safe which means they could crash the trading platform. To stop this from happening Spotware now displays a warning message in the cBot log telling the user to use the command BeginInvokeOnMainThread
What is BeginInvokeOnMainThread
You can only update the user interface from the main UI thread. If you are running code on a background thread and need to update the UI, BeginInvokeOnMainThread() allows you to force your code to run on the main thread, so you can update the UI.
This warning usually occurs if you call another thread that is not safe and then try and access a property r object from the main thread like account information or trade events, you can find a workaround by using the BeginInvokeOnMainThread call to access these events. A simple example is shown below to update a windows forms application.
_robot.BeginInvokeOnMainThread(() =>
{
this.Text = _robot.Symbol.Name;
});
Where _robot is the Robot class object from cTrader that has been passed to a separate assembly class which displays a user interface.