IoC inside AddIn

IoC inside AddIn

Hello everyone, looking for help regarding to integration of Zenon AddIn. We are creating a Addin that shall do several stuff like running WebSocket server, Http Api server and of course consume some data from Zenon itself, like Variables or Language texts. I am using Autofac for DI and have troubles to get it working. First anyone around who successfully used IoC inside AddIn implemenation? Second topic is related to error: Could not load file or assembly 'System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' - I have added library at AddinInfo.cs file, like [assembly: AddinModule("System.Web.Http.dll")] It mitigates the error, but then next error related to missing Autofac assembly appears and second declaration like [assembly: AddinModule("Autofac.dll")] causes the error (duplicit addinmodule). When I create all classes manually with new, it usually works. Any hint is most welcome. Cheers, Jaroslav From Zenon log 02 L 10.0.75.1 2594 1 35BC 190703075830,524836 01 00 0003 e:\builds\1_zenon\zenon\zenon800_build\source\cdnetwrapper\managed\logclient.cpp 0007 CDNetWrapper::LogClient::LogMessage 0004 98 0027 Scada.Internal.DotNetAddInExtension.AddInIntegration.Startup Error while starting service with id 'ZenMobile.AddIn.ZenonProjectService.ZenMobile.AddIn.Service.ProjectServiceExtension' Exception information:Scada.Internal.AddIn.Engine.ExtensionManagement.ExtensionExecutionException Error while starting service with id 'ZenMobile.AddIn.ZenonProjectService.ZenMobile.AddIn.Service.ProjectServiceExtension' Void Start() ~~Server stack trace: ~~ at Scada.Internal.AddIn.Engine.ExtensionManagement.ServiceExtensionController`2.Start()~~ at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)~~ at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)~~~~Exception rethrown at [0]: ~~ at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)~~ at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)~~ at Scada.Internal.AddIn.Engine.Contracts.ExtensionManagement.IServiceExtensionController.Start()~~ at Scada.Internal.AddIn.Engine.ExtensionManagement.ServiceManager.StartService(String instanceId, IServiceExtensionController serviceExtensionController)~~ at Scada.Internal.AddIn.Engine.ExtensionManagement.AddInRunner.StartService(String instanceId, IScadaExtensionNode node)~~ at Scada.Internal.AddIn.Engine.Services.AddInService.Startup(String instanceId)~~System.NullReferenceException Object reference not set to an instance of an object. at ZenMobile.AddIn.Service.ProjectServiceExtension.LogProjectInfo(IProject project)~~ at ZenMobile.AddIn.Service.ProjectServiceExtension.Start(IProject context, IBehavior behavior)~~ at Scada.Internal.AddIn.Engine.ExtensionManagement.ServiceExtensionController`2.Start()

This is a migrated post! Originally posted on 21.06.2019 by user jaroslavurban. Please be aware that information can be outdated.