nauful / LibUA

Open-source OPC UA client and server library
Apache License 2.0
262 stars 94 forks source link

BadAttributeIdInvalid when browsing Server #155

Closed Superwalker34 closed 7 months ago

Superwalker34 commented 7 months ago

Hello Great library! I'm developing an OPC-UA Server as module to an existing Machine control software. I'm quite new in OPC-UA world, please forgive me if my question is dumb.

I'm facing a browsing error within standard Server topic with uaExpert: image

I think this BadAttributeIdInvalid of ValueRank makes trouble within Kepware Client in browsing phase.

I made a test: In HandleReadRequest I added line 626 .NET:

else if (readValueIds[i].AttributeId == NodeAttribute.ValueRank && !(node is NodeVariable))
{
    res[i] = new DataValue(-1, StatusCode.Good);
}

Now I don't have errors anymore in uaExpert. It means that uaExpert try to get a ValueRank of of a no-NodeVariable. I don't understand why?

nauful commented 7 months ago

UaExpert tries to read all possible attributes for every node to show in its attribute table on the right side of the window, even invalid ones. ValueRank is not valid for values which aren't arrays.