Skip to content

Migrating From .NET Framework

Migration to .NET 6.0

cTrader desktop migrated from .NET Framework to .NET 6.0 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

Prior to the migration, cTrader was using .NET Framework 4.0 (and C# version 4). All algos 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. Consult the reference library to learn the new method/parameter names and method overloads.

How to Migrate to .NET 6.0

To migrate from .NET Framework to .NET 6.0, 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.0 via the 'Target Framework' dropdown menu.

Image title

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.

As the cTrader Algo API is not thread safe, you have to use the BeginInvokeOnMainThread method whenever you call/access an API member.