Hey guys!
I’m trying to get a scheduled task to work. All I want it to do is basically log something or print to console once a minute.
I declare the following in the web.config file:
<scheduledTask type="Litium.Accelerator.Services.MarketplaceIntegrationService, Litium.Accelerator" startTime="17:00" interval="1m" />
I have created a corresponding class called MarketplaceIntegrationService. The scheduled task is created and in the eventlog can be seen:
Register scheduled task to start 2019-09-09 17:00:00 with interval 00:01:00. Type: Litium.Accelerator.Services.MarketplaceIntegrationService, Litium.Accelerator
However, right next to it is an error as follows:
GenericArguments[0], 'Litium.Accelerator.Services.MarketplaceIntegrationService', on 'Litium.Foundation.Tasks.ScheduledTaskManager+TaskExecutionContext
1[T]’ violates the constraint of type ‘T’.System.ArgumentException: GenericArguments[0], 'Litium.Accelerator.Services.MarketplaceIntegrationService', on 'Litium.Foundation.Tasks.ScheduledTaskManager+TaskExecutionContext
1[T]’ violates the constraint of type ‘T’. —> System.TypeLoadException: GenericArguments[0], ‘Litium.Accelerator.Services.MarketplaceIntegrationService’, on ‘Litium.Foundation.Tasks.ScheduledTaskManager+TaskExecutionContext`1[T]’ violates the constraint of type parameter ‘T’.
at System.RuntimeTypeHandle.Instantiate(RuntimeTypeHandle handle, IntPtr* pInst, Int32 numGenericArgs, ObjectHandleOnStack type)
at System.RuntimeTypeHandle.Instantiate(Type[] inst)
at System.RuntimeType.MakeGenericType(Type[] instantiation)
— End of inner exception stack trace —
at System.RuntimeType.ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception e)
at System.RuntimeType.MakeGenericType(Type[] instantiation)
at Litium.Foundation.Tasks.ScheduledTaskManager.RegisterScheduledTask(Type type, TimeSpan dueTime, TimeSpan interval, String parameters)
How can I get rid of this error and how do I go about doing somethin useful with said class? Some interface/class to be implemented/inherited? Any help would be appreciated.
Litium version: 7.2.3