I have a customer who is updating his previously working code to the 5.59 release of OPC Data Client. The code was working on 5.58.
This project takes tag values from a Beckhoff TwinCAT PLC via TOP Server. The tag names and locations are set in a SQLite Database, which is loaded during the runtime.
When he subscribes to more than approximately 600 tags, a Null Reference Exception is thrown. We recognize that the cause for this change in behavior from 5.58 to 5.59 is that input arguments are now consistently checked for nullness of their elements before a method body is executed. However, the customer needs clarification on the cause of the exception. Unfortunately, stepping through with breakpoints has not provided him with much clarification. When checking with other clients, no tag values appear to be null.
I believe this has to do with the data from the PLC, but that the customer wants to understand the error better so he can know where to look for on the PLC side. I have been working on replicating the error in case it is necessary, but I am absolutely not expecting you to replicate or fix the issue unless you believe there is something that can be done on the Data Client side.
I have included the exception below. Please let me know if you have any questions!
System.NullReferenceException: Object reference not set to an instance of an object.
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.AddMonitoredItemsToSdkSubscription(IEnumerable`1 clientMonitoredItemEnumerable, UAUpdateContext updateContext)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.ChangeMonitoredItemsInSdkSubscription(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd, UAUpdateContext updateContext)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.ChangeMonitoredItemsInSdkSubscription(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.InternalPerformSdkSubscriptionChanges(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.<PerformSdkSubscriptionChanges>b__84_2(IReadOnlyList`1 itemsToAddChunk)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IReadOnlyListExtension.<>c__DisplayClass2_0`1.<ChunkProcess>b__0(IReadOnlyList`1 list)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IReadOnlyListExtension.ChunkSelect[TInput,TOutput](IReadOnlyList`1 readOnlyList, Func`2 chunkSelector, Int32 chunkSize)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IReadOnlyListExtension.ChunkProcess[TInput](IReadOnlyList`1 readOnlyList, Action`1 chunkProcessor, Int32 chunkSize)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.PerformSdkSubscriptionChanges(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.ManipulateSdkSubscription(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.TryManipulateSdkSubscription(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionLocker.OnLastUnlock()
at OpcLabs.BaseLib.Algorithms.Internal.Locker.Unlock()
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.UnlockMonitoredItems()
at OpcLabs.EasyOpc.UA.Implementation.NetSdk.ClientServer.EasyUAClientEngine.<>c.<SubscribeMonitoredItems>b__38_0(UASmartClientSubscription subscription)
at System.Collections.Generic.List`1.ForEach(Action`1 action)
at OpcLabs.EasyOpc.UA.Implementation.NetSdk.ClientServer.EasyUAClientEngine.SubscribeMonitoredItems(NetSdkEasyUAClient easyClient, EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray, EasyUAAdaptableParameters adaptableParameters)
at OpcLabs.EasyOpc.UA.Implementation.NetSdk.ClientServer.NetSdkEasyUAClient.InternalSubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.NetSdk.ClientServer.NetSdkEasyUAClient.<>c__DisplayClass37_0.<SubscribeMultipleMonitoredItems>b__0()
at OpcLabs.BaseLib.DisposableObject.DisposeGuard[TResult](Func`1 func)
at OpcLabs.BaseLib.DisposableObject.DisposeGuardNotNull[TResult](Func`1 func)
at OpcLabs.EasyOpc.UA.Implementation.NetSdk.ClientServer.NetSdkEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.DelegatingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.DelegatingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.MultiplexingEasyUAClient.<>c.<SubscribeMultipleMonitoredItems>b__12_0(IEasyUAClient client, IReadOnlyList`1 list)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IReadOnlyListExtension.SwitchCase[TInput,TOutput,TKey](IReadOnlyList`1 readOnlyList, Func`2 keySelector, IEqualityComparer`1 keyComparer, Func`3 outputSelector)
at OpcLabs.EasyOpc.UA.Implementation.MultiplexingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.DelegatingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.DelegatingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.EasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at Buhler.Connectivity.OPCUA.QuickOPCClientComm.Subscribe(IList`1 IOs) in E:\_Projekte_VisualStudio\_GLC\GLC Tools\Main\Sources\Buhler.Connectivity.OPCUA\QuickOPC\QuickOPCClientComm.Subscribe.cs:line 121
This project takes tag values from a Beckhoff TwinCAT PLC via TOP Server. The tag names and locations are set in a SQLite Database, which is loaded during the runtime.
When he subscribes to more than approximately 600 tags, a Null Reference Exception is thrown. We recognize that the cause for this change in behavior from 5.58 to 5.59 is that input arguments are now consistently checked for nullness of their elements before a method body is executed. However, the customer needs clarification on the cause of the exception. Unfortunately, stepping through with breakpoints has not provided him with much clarification. When checking with other clients, no tag values appear to be null.
I believe this has to do with the data from the PLC, but that the customer wants to understand the error better so he can know where to look for on the PLC side. I have been working on replicating the error in case it is necessary, but I am absolutely not expecting you to replicate or fix the issue unless you believe there is something that can be done on the Data Client side.
I have included the exception below. Please let me know if you have any questions!
System.NullReferenceException: Object reference not set to an instance of an object.
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.AddMonitoredItemsToSdkSubscription(IEnumerable`1 clientMonitoredItemEnumerable, UAUpdateContext updateContext)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.ChangeMonitoredItemsInSdkSubscription(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd, UAUpdateContext updateContext)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.ChangeMonitoredItemsInSdkSubscription(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.InternalPerformSdkSubscriptionChanges(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.<PerformSdkSubscriptionChanges>b__84_2(IReadOnlyList`1 itemsToAddChunk)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IReadOnlyListExtension.<>c__DisplayClass2_0`1.<ChunkProcess>b__0(IReadOnlyList`1 list)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IReadOnlyListExtension.ChunkSelect[TInput,TOutput](IReadOnlyList`1 readOnlyList, Func`2 chunkSelector, Int32 chunkSize)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IReadOnlyListExtension.ChunkProcess[TInput](IReadOnlyList`1 readOnlyList, Action`1 chunkProcessor, Int32 chunkSize)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.PerformSdkSubscriptionChanges(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.ManipulateSdkSubscription(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.TryManipulateSdkSubscription(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd)
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionLocker.OnLastUnlock()
at OpcLabs.BaseLib.Algorithms.Internal.Locker.Unlock()
at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientSubscriptionBase.UnlockMonitoredItems()
at OpcLabs.EasyOpc.UA.Implementation.NetSdk.ClientServer.EasyUAClientEngine.<>c.<SubscribeMonitoredItems>b__38_0(UASmartClientSubscription subscription)
at System.Collections.Generic.List`1.ForEach(Action`1 action)
at OpcLabs.EasyOpc.UA.Implementation.NetSdk.ClientServer.EasyUAClientEngine.SubscribeMonitoredItems(NetSdkEasyUAClient easyClient, EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray, EasyUAAdaptableParameters adaptableParameters)
at OpcLabs.EasyOpc.UA.Implementation.NetSdk.ClientServer.NetSdkEasyUAClient.InternalSubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.NetSdk.ClientServer.NetSdkEasyUAClient.<>c__DisplayClass37_0.<SubscribeMultipleMonitoredItems>b__0()
at OpcLabs.BaseLib.DisposableObject.DisposeGuard[TResult](Func`1 func)
at OpcLabs.BaseLib.DisposableObject.DisposeGuardNotNull[TResult](Func`1 func)
at OpcLabs.EasyOpc.UA.Implementation.NetSdk.ClientServer.NetSdkEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.DelegatingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.DelegatingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.MultiplexingEasyUAClient.<>c.<SubscribeMultipleMonitoredItems>b__12_0(IEasyUAClient client, IReadOnlyList`1 list)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IReadOnlyListExtension.SwitchCase[TInput,TOutput,TKey](IReadOnlyList`1 readOnlyList, Func`2 keySelector, IEqualityComparer`1 keyComparer, Func`3 outputSelector)
at OpcLabs.EasyOpc.UA.Implementation.MultiplexingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.DelegatingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.DelegatingEasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at OpcLabs.EasyOpc.UA.EasyUAClient.SubscribeMultipleMonitoredItems(EasyUAMonitoredItemArguments[] monitoredItemArgumentsArray)
at Buhler.Connectivity.OPCUA.QuickOPCClientComm.Subscribe(IList`1 IOs) in E:\_Projekte_VisualStudio\_GLC\GLC Tools\Main\Sources\Buhler.Connectivity.OPCUA\QuickOPC\QuickOPCClientComm.Subscribe.cs:line 121