Hi all,
I keep getting the error below in the logging of a connector. I suspect the problem is in the loading of the referenced dll, but I can't figure out how to resolve it.
2022/07/12 14:14:08.301|SLManagedScripting.exe|ManagedInterop|CRU|-1|5|System.MissingMethodException: Method not found: 'Skyline.DataMiner.Library.Common.DmsElementId Meinberg.Nms.IAC.Communication.Generic.ElementInfoEvent.get_DmsElementId()'.
The cause:
The problem is that the Meinberg NuGet has a dependency on version 1.2.2.1 of the class library but in your solution (that uses meinberg nuget) you're installing the 1.2.2.4 nuget of the class library.
This means your QAction will have both dll's in the dllimport attribute and DataMiner will currently load up both version 1.2.2.1 and 1.2.2.4 of that library and the data returned from meinberg will expect the DmsElementId class of 1.1.2.1 but find 1.1.2.4 which causes errors.
The solution:
To fix this, you'll need to make sure all your libraries and solutions have a dependency on the same version of class library.
More details:
https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions
For normal programs during compilation it will perform something called unification where a automatically generated bindingredirect is added to a file next to the .exe. The binding redirect will say that any request at runtime to a method inside class library 1.2.2.1 should use 1.2.2.4 instead. Within DataMiner it's not possible to add that binding redirect because SLManagedScripting is a single process shared between all protocols and QActions. So any bindingredirect would impact all the protocol QActions.
Instead of unification, we use parallel loading where both versions of the assembly get loaded. This works between QActions and protocols, but as shown here it can cause strange behavior if multiple versions of the same assembly are needed in the same protocol.
We're brainstorming options to split up SLManagedScripting and protocols in general into more modular 'single' programs. That would also help fix this issue and allow us to add bindingredirects and use unification.
Just to build further on Jens' answer.
If you are using nuggets in the solution, you will have to place the DLL files/nuget folder in the "Skyline DataMiner\ProtocolScripts\DllImport" folder.
More information can be found here:
Hi Stijn,
It looks like you're missing the Meinbergh API dll. Can you confirm that it's available on your system?
The dll ‘SLC.CLib.Meinberg.Nms.IAC.dll’ is available under the folder “C\:Skyline DataMiner\ProtocolScripts\DllImport\slc.clib.meinberg.nms.iac\1.0.10325.21-1.0.0.x.21\lib\net462”. I uploaded the connector via the ‘.dmprotocol’ package, which contains that dll.
Can you verify in the uploaded protocol that the dllImport reference on the impacted QAction is correct?
This is the dllImort reference: ‘slc.clib.meinberg.nms.iac\1.0.10325.21-1.0.0.x.21\lib\net462\SLC.CLib.Meinberg.Nms.IAC.dll’
Hi Stijn
Based on the error I see that the class DmsElementId is being used, which is part of the Class Library. I assume that the Meinberg NuGet has a dependency to the Class Library NuGet? If not, then that would likely be the issue.
Hi Jens, I’m working with Nuget packages