Page 1 of 1

ServerInternalClient.CreateDataMonitoredItems adding>1 items

Posted: 23 Aug 2013, 11:25
by NicovanVeen
Hello Forum

First of all I want UA compliment with the fantastic product.

I'm facing a problem with the ServerInternalClient.CreateDataMonitoredItems method. I am using Unified Automation UA .NET SDK Bundle 2.2.1 (BINARY Edition). VS 2010

The situation is : I want to use two node managers excahnging data. I want to execute a method on one node manager on the change of a data value on the other node manager. I created at the server startup a ServerInternalClient object in wich I programmed the method "addMonitoredItem".

"addMonitoredItem" uses CreateDataMonitoredItems to add monitored items.

The problem is
Adding the first monitored item works fine. However when I try to add a second monitored item (and third) the CreateDataMonitoredItems comes with an execption : "Object reference not set to an instance of an object."

I brought the problem back to its basics. Therefore I slightly modified the Lesson05_2010 project.
I added a class for the serverinternal client CIT_ServerInternalClient with method addMonitoredItem(NodeId nodeId).

At the OnRootNodeManagerStarted in the server manager I make a instance of the ServerInternalClient and I call 2 times addMonitoredItem.
The first time I add the nodeID fine and executes the Callback, the second time it makes the exception.

Can anyone tell me how to tackle this problem?

Kind regards

Nico van Veen

Re: ServerInternalClient.CreateDataMonitoredItems adding>1 i

Posted: 27 Aug 2013, 08:20
by Support Team
Hi Nico,

There is a bug in the SDK. As a work around always provide your own RequestContext instead of DefaultRequestContext as shown:

Code: Select all

RequestContext context = new RequestContext(m_server, new string[] { "de-DE" }, new UserIdentity(), ServiceType.Unknown);
List<MonitoredItemCreateResult> TheResults = new List<MonitoredItemCreateResult>();
TheResults = CreateDataMonitoredItems(context, TheMonitoredItems);

Best Regards,
Support Team