I'm using QuickOPC version="5.63.0-rev3" and it's an WPF application made in C#
I get this exception now and then
OpcLabs.EasyOpc.UA.OperationModel.UAException
HResult=0x80131600
Message=An OPC-UA operation failure with error ID 'OpcLabs.UAEngine=4507' occurred, originating from '' and with depth of 1. The inner exception, of type "OpcLabs.EasyOpc.UA.Engine.UAEngineException", contains details about the problem.
Source=OpcLabs.EasyOpcUA
StackTrace:
at OpcLabs.EasyOpc.UA.IEasyUAClientExtension.ReadValue(IEasyUAClient client, UAReadArguments readArguments)
at OpcLabs.EasyOpc.UA.IEasyUAClientExtension.ReadValue(IEasyUAClient client, UAEndpointDescriptor endpointDescriptor, UANodeDescriptor nodeDescriptor)
at OpcUa.OpcUaClient.ReadBool(String tag) in E:\Users\ame\source\repos\foo\DCSkyltLaser\OpcUa\OpcUaClient.cs:line 357
Inner Exception 1:
UAEngineException: Cannot lock the OPC-UA client session because it is not available.
+ The client method called (or event/callback invoked) was 'ReadMultiple[1]'.
The client method may be ReadValue, WriteValue, ReadMultiple, WriteMultiple,
The function that I have called OpcUa.OpcUaClient.ReadBool(String tag) is using ReadValue to read a boolean tag.
When this or other UAEceptions occurr: Is it enough to return an error and try to call the function again?
public bool ReadBool(string tag)
{
bool result = true;
try
{
var server = _cfg.ServerUrl;
UAEndpointDescriptor endpointDescriptor = new UAEndpointDescriptor(server);
UANodeDescriptor tagNodeDescriptor = new UANodeDescriptor(_FromTags.GetTag(tag));
result = (bool)_easyUAClient.ReadValue(
endpointDescriptor, tagNodeDescriptor
);
}
catch (UAException uaException)
{
Log.Fatal(uaException, $",Failure: {uaException.GetBaseException().Message}");
result = false;
}
return result;
}