Unable to load assembly: Assembly must contain single algo type

Created at 03 Jul 2018, 21:53
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
SO

solark

Joined 28.03.2016

Unable to load assembly: Assembly must contain single algo type
03 Jul 2018, 21:53


I get the following build error on everything after the upgrade (what's already built still works). Need more details on what this error is. It's a significant breaking change for a forced upgrade.


@solark
Replies

... Deleted by UFO ...

PanagiotisCharalampous
04 Jul 2018, 09:07

Hi solark,

Can you send us an example cBot to check?

Best Regards,

Panagiotis


@PanagiotisCharalampous

solark
04 Jul 2018, 19:57

Minimal example. Compile the following fsx to an assembly


#r @"C:\Users\SomeUser\Documents\cAlgo\API\cAlgo.API.dll"
open cAlgo.API
open System

type AlgoAttribute(name) = 
    inherit Attribute()
    member val Name = name
    member val ParseSource = false with get,set
    member val DestinationDirectory = @"C:\Users\SomeUser\Documents\cAlgo\Sources\Robots\" with get,set
    member val TimeZone = "" with get,set

[<assembly: Algo("StartTest")>]
do()

type Robot2Attribute() = inherit Attribute()

[<Robot2>]
type Current(r : Robot) = 
    member x.OnStart() = r.Print("Hi")

 

 

Create a proxy calgo in ctrader, adding both the above and FSharp.Core as references:

 

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace cAlgo
{
    using System;
    using System.Linq;
    using cAlgo.API;
    using cAlgo.API.Indicators;
    using cAlgo.API.Internals;
    using cAlgo.Indicators;
    using System.Collections.Generic;
    using System.IO;


    [Robot(TimeZone = cAlgo.API.TimeZones.UTC, AccessRights = cAlgo.API.AccessRights.FullAccess)]
    public class StartTest : cAlgo.API.Robot
    {

        private Starttest.Current Current;

        protected override void OnStart()
        {
            Current = new Starttest.Current(this);
            Current.OnStart();
        }

    }
}

 

And get a build error. Only started being an issue after the update.

 


@solark

PanagiotisCharalampous
06 Jul 2018, 11:05

Hi solark,

Thanks for the additional information. We have tested it locally and it works. Any chance you are missing something in the process?

Best Regards,

Panagiotis


@PanagiotisCharalampous