Type of Issue
[X] Bug [ ] Enhancement [ ] Compliance [ ] Question [ ] Help wanted
Describe the Issue
The reference C# client was most of the times I connected to Integration Object's free OPC UA Server Simulator freezing and not showing the nodes and tags in the browser window. Sometimes, but rarely it worked, and when trying to restart the reference client it would just freeze after connecting.
To Reproduce
Steps to reproduce the behavior:
Compile Reference Client and start it from Visual Studio Debugger (press F5)
Download, install and start Integrated Objects' OPC UA Server Simulator
Connect with the Reference Client to the OPC UA Server Simulator address
Most of the time, the Reference Client's UI will freeze completely
Expected behavior
Most of the times, the Reference Client's UI will freeze
Code snippets
I managed to get the Reference Client to work reliably, by introducing lock-statements for the variable 'm_numericIds' in class Opc.Ua.NodeIdDictionary, in methods Add(NodeId, T value) and TryGetValue(NodeId key, out T value), as follows:
In Add() method, the following case-statement was changed as follows:
case IdType.Numeric:
{
ulong id = ((ulong)key.NamespaceIndex) << 32;
id += (uint)key.Identifier;
lock (m_numericIds)
{
m_numericIds.Add(id, value);
}
return;
}
And in TryGetValue method, the following code was used:
case IdType.Numeric:
{
ulong id = ((ulong)key.NamespaceIndex) << 32;
id += (uint)key.Identifier;
bool _result = false;
lock (m_numericIds)
{
_result = m_numericIds.TryGetValue(id, out value);
}
return _result;
//return m_numericIds.TryGetValue(id, out value);
Environment (please complete the following information):
OS: Windows 10 Pro
Development environment: Visual Studio 2019 16.9.2
Runtime: NET 4.6.2
OPC Package Release Version: Latest from GitHub master.
Component: Opc.Ua.NodeIdDictionary
Server: Integrated Object's OPC UA Server Simulator
Client: OPC Foundation's Reference Client
Additional context
After the changes shown above, the Reference Client was working. I do not say that this is necessary the absolute correct fix here, but I think this shows where the problem is. A fix to the master copy would be good to implement.
Type of Issue [X] Bug [ ] Enhancement [ ] Compliance [ ] Question [ ] Help wanted
Describe the Issue
The reference C# client was most of the times I connected to Integration Object's free OPC UA Server Simulator freezing and not showing the nodes and tags in the browser window. Sometimes, but rarely it worked, and when trying to restart the reference client it would just freeze after connecting.
To Reproduce Steps to reproduce the behavior:
Expected behavior Most of the times, the Reference Client's UI will freeze
Code snippets I managed to get the Reference Client to work reliably, by introducing lock-statements for the variable 'm_numericIds' in class Opc.Ua.NodeIdDictionary, in methods Add(NodeId, T value) and TryGetValue(NodeId key, out T value), as follows:
In Add() method, the following case-statement was changed as follows:
And in TryGetValue method, the following code was used:
Environment (please complete the following information):
Additional context After the changes shown above, the Reference Client was working. I do not say that this is necessary the absolute correct fix here, but I think this shows where the problem is. A fix to the master copy would be good to implement.