From 79f4da032c5d3a16e41f1a3ea25f548af48396f8 Mon Sep 17 00:00:00 2001 From: Oyvind Landsnes Date: Thu, 24 May 2018 19:38:53 +0200 Subject: [PATCH] AddReferences method returns too early The AddRefrences method exists in similar versions in several of the sample node manager classes. The method loops through a list of (external) references and adds them to the designated objects. When obtaining node handles it also checks that the node is valid in the current context. The problem was that it skipped the rest of the nodes in the list as soon as it found one node that wass not valid. This change ensures that all nodes in the references list are processed. --- .../SDK/Opc.Ua.Server/Diagnostics/v10/CustomNodeManager.cs | 2 +- .../Samples/Opc.Ua.Sample/Base/CustomNodeManager.cs | 2 +- .../Samples/Opc.Ua.Sample/Base/SampleNodeManager.cs | 2 +- SampleApplications/Workshop/Common/QuickstartNodeManager.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SampleApplications/SDK/Opc.Ua.Server/Diagnostics/v10/CustomNodeManager.cs b/SampleApplications/SDK/Opc.Ua.Server/Diagnostics/v10/CustomNodeManager.cs index 64b29da891..22e41c7649 100644 --- a/SampleApplications/SDK/Opc.Ua.Server/Diagnostics/v10/CustomNodeManager.cs +++ b/SampleApplications/SDK/Opc.Ua.Server/Diagnostics/v10/CustomNodeManager.cs @@ -818,7 +818,7 @@ namespace Opc.Ua.Server if (source == null) { - return; + continue; } // add reference to external target. diff --git a/SampleApplications/Samples/Opc.Ua.Sample/Base/CustomNodeManager.cs b/SampleApplications/Samples/Opc.Ua.Sample/Base/CustomNodeManager.cs index 9578dd3620..ee8f28ceec 100644 --- a/SampleApplications/Samples/Opc.Ua.Sample/Base/CustomNodeManager.cs +++ b/SampleApplications/Samples/Opc.Ua.Sample/Base/CustomNodeManager.cs @@ -824,7 +824,7 @@ namespace Opc.Ua.Sample if (source == null) { - return; + continue; } // add reference to external target. diff --git a/SampleApplications/Samples/Opc.Ua.Sample/Base/SampleNodeManager.cs b/SampleApplications/Samples/Opc.Ua.Sample/Base/SampleNodeManager.cs index 692019f826..a5d5ba9c53 100644 --- a/SampleApplications/Samples/Opc.Ua.Sample/Base/SampleNodeManager.cs +++ b/SampleApplications/Samples/Opc.Ua.Sample/Base/SampleNodeManager.cs @@ -817,7 +817,7 @@ namespace Opc.Ua.Sample if (source == null) { - return; + continue; } // add reference to external target. diff --git a/SampleApplications/Workshop/Common/QuickstartNodeManager.cs b/SampleApplications/Workshop/Common/QuickstartNodeManager.cs index d04e2db535..4fc67b8359 100644 --- a/SampleApplications/Workshop/Common/QuickstartNodeManager.cs +++ b/SampleApplications/Workshop/Common/QuickstartNodeManager.cs @@ -928,7 +928,7 @@ namespace Quickstarts // only support external references to nodes that are stored in memory. if (source == null || !source.Validated || source.Node == null) { - return; + continue; } // add reference to external target.