Hello,
I'm getting the following error when trying to programmatically create element in DataMiner.
2022/04/25 14:51:25.291|SLManagedScripting.exe|ManagedInterop|ERR|1|28|NMLOG|[GetNumberOfElements]|Exception => System.ArgumentException DataMiner agent ID in "4294967295/4294967295" is not an integer value
Parameter name: id ( [GetNumberOfElements] )
at Skyline.DataMiner.Library.Common.DmsElementId..ctor(String id)
at Skyline.DataMiner.Library.Common.ReplicationSettings.Load(ElementInfoEventMessage elementInfo)
at Skyline.DataMiner.Library.Common.DmsElement.ParseElementInfo(ElementInfoEventMessage elementInfo)
at Skyline.DataMiner.Library.Common.DmsElement.Parse(ElementInfoEventMessage elementInfo)
at Skyline.DataMiner.Library.Common.DmsElement..ctor(IDms dms, ElementInfoEventMessage elementInfo)
at Skyline.DataMiner.Library.Common.Dma.GetElements()
at OneWeb.SkylineClassCommon.GetNumberOfElements(ISLProtocolWrapper protocol, Int32 agentId)
This previously worked without issue so can't understand why I'm having trouble with this now.
I'm currently running DataMiner Version (10.2.4.0-11608)
Hi Alexander, I believe this is because "4294967295" is larger than the expected integer value. The maximum value an integer can have is 2147483647. It looks like you're actually at the maximum unsigned integer value (4,294,967,295).
I'd try creating the elements at a lower value and see if that works. My guess is DataMiner expects a number less than the maximum (signed) integer value.
Hi Alexander,
This looks to be a combination of 2 issues:
- DataMiner is returning an element with an invalid DataMiner / Element ID.
- The class library is failing to parse this invalid ID when retrieving the Number of Elements, while it should probably handle this invalid ID better and return the number of valid elements.
You can likely fix this issue by deleting the element with the invalid ID. To find this element you can check the alarm console for errors/notices or looking for related errors in the DataMiner logging (most likely SLDataMiner.txt, SLErrors.txt, SLNet.txt). You may also be able to find this element by opening the root view card, selecting "elements" (below this view), then sorting on the "ID" column (look for an element that has ID 0).
It’s also worth noting that we’re in a 4 agent cluster, with a CNMA having a failover pair.
I wasn’t able to find any elements with an ID of 0.
We’re using the following methods to call this:
public static string GetElementFullId(ISLProtocolWrapper protocol, int agentId, string elementName)
{
string elementId = null;
protocol.Log(string.Format(“[GetElementFullId] From Agent agentId={0} elementName = {1}”, agentId, elementName), Severity.DEBUG);
try
{
IDms dms = protocol.getDms();
IDma agent = dms.GetAgent(agentId);
IDmsElement dmsElement = agent.GetElement(elementName);
elementId = GetElementFullId(dmsElement);
protocol.Log(string.Format(“[GetElementFullId] From Agent elementId = {0} for {1}”, elementId, elementName), Severity.DEBUG);
}
catch (Exception e)
{
protocol.Log(e, “[GetElementFullId] From Agent id=” + agentId, Severity.DEBUG);
}
return elementId;
}
public static string GetElementFullId(IDmsElement dmsElement)
{
string fullId = null;
if (dmsElement != null)
{
fullId = dmsElement.DmsElementId.AgentId + “/” + dmsElement.DmsElementId.ElementId;
}
return fullId;
}