Migrating From .NET Framework
When Did cTrader Migrate From .NET Framework¶
cTrader desktop migrated from .NET framework to .NET 6 in version 4.2. This resulted in a number of significant changes to the UI and how cBots/indicators are compiled and built.
Key Changes Arising From Migration¶
Prior to the migration, cTrader was using .NET Framework 4.0 (and C# version 4). All cBots and indicators were running inside the main cTrader desktop process.
After migration, cTrader now uses separate child processes for indicators/cBots. It also uses a dedicated Nuget package for building .algo
files.
That said, new releases of cTrader are backwards compatible with code written before the migration. Apart from a few exceptions, you can freely use indicators/cBots that were built in older versions of cTrader.
Note
Some parameter names and methods have been changed during the migration. When building your old cBots/indicators in newer versions of cTrader, you may receive build errors/warnings because of this. Please, consult the reference library to learn the new method/parameter names and method overloads.
How to Migrate From .NET Framework to .NET¶
To migrate from .NET Framework to .NET 6, please, rebuild your indicator/cBots inside cTrader desktop 4.2 or a later version. During rebuilding, cTrader will automatically change the .NET project structure to the new SDK style.
After rebuilding, change your indicator/cBot target framework to .NET 6 via the 'Target Framework' drop-down menu.
Test your indicator/cBot after rebuilding.
Note
If your indicator/cBot uses File
, Registry
, or Internet
access rights, change them to FullAccess
.
In version 4.2, cBots/indicators that are using multiple threads cannot call any API members. This can be addressed by using the BeginInvokeOnMainThread
method to call an API method/member. Otherwise, your code will throw an error, and your cBot/indicator process will be terminated.
As cTrader Automate API is not thread safe, you have to use the BeginInvokeOnMainThread
method whenever you call/access an API member.