How to retrieve data from Elipse server with .Net Core? Am I restrained to .NET Framework for using a DLL?

1

I have an Elipse E3 Studio (build 5.0.434) server with a bunch of tags (running on a x64 windows) and I want to read then from a .NetCore (3.0) console application (same machine). The thing is Elipse works with COM (as far as I know) and .NetCore can't natively handle it. Gotta use some Interoperability Library or something. .netCore3.0 Release Notes at Windows Native Interop

To make the Elipse server work I used a hardkey so the server was running locally. I have named my tag "A1" and set the value inside Elipse. To make the access I made a C# program using e3DataAccessLib and referenced it on the .csprj. The Program.cs is as follows :

using System;
using E3DATAACCESSLib; 


namespace ElipseNetCore{
    class Program{
        static void Main(string[] args){
            try{
                E3DataAccessManager e3DA = new E3DataAccessManager();
                e3DA.Server = "localhost"; //kinda pointless but still
                object Value = new object();
                object Timestamp = new object();
                object Quality = new object();
                e3DA.ReadValue("A1.Value", ref Timestamp, ref Quality, ref Value); //ReadValue is a Elipse Server method that takes in a "tag" and place the result in the ref's
                Console.WriteLine($"Value:  {Value}, Timestamp: {Timestamp} and Quality: {Quality}");
            }//end try
            catch(Exception ex){
                Console.WriteLine("the mother funking error now is :" +ex.ToString());
//regsvr32 C:\Users\lucas.battistella\Documents\Desenvolvimento\ElipseNetCore\ElipseNetCore\obj\Release\netcoreapp2.2\win-x64\ElipseNetCore.dll
            }//end catch try
        }//end Main
    }//end Program
}//end namespace

The Error I get is the following:

System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {80327130-FFDB-4506-B160-B9F8DB32DFB2} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

Other answers point to a x32 on a x64 or vice-versa issue. However I've already tried making sure everything is running on x64. Then I tried everything on x32/x86. Also tried manually registering the .dll with regsvr32 (as show in the commented out line in the first code block and also the E3DATAACESSLib.dll), got and error popup saying "the said dll was loaded but the entry point DllRegisterServer was not located. Verify if the said dll is a DLL or OCX file"

I've been entangled with this problem for a few days now and since I'm new to all this I don't even know if I'm tumbling in the right direction. I would really appreciate any explanation and please excuse my typos.

How do I retrieve data from an Elipse server? Have I missed something?

UPDATE: I have tried that exact same code on Visual Studio running on .Net Framework 4.7.2 and it worked. Also tried (still on Visual Studio) on .NetCore and got the aforementioned error.

c#
visual-studio
dll
com
.net-4.7.2
asked on Stack Overflow Oct 3, 2019 by Lucas Battistella • edited Oct 17, 2019 by Lucas Battistella

1 Answer

0

Work Around: Forget about NetCore and migrate to NetFramework 4.8. Forget about VSCode and keep rolling with VS. Every time I look back at this problem it intrigues me. The E3DATAACCESSLib was build against x32 and for NetFramework (which mean Windows necessarily). The weird bit is that it ran on my machine targeting x86 (VS and NetFramework 4.8) but not on VSCode and NetCore. I read conflicting information on libraries built for NetFramework working (or not) on Core. Today I tried running the built working code on a different machine (virtual and remote) and it showed me the exact same error message. And I fixed it by installing the E3 program and restarting the machine, simple as that. If that ring any bell to you please share the light.

answered on Stack Overflow Nov 22, 2019 by Lucas Battistella

User contributions licensed under CC BY-SA 3.0