Open 11v1 opened 4 years ago
Further investigation showed following: method BaseVariableState.DecodeExtensionObject should return value by this condition:
if (targetType.IsInstanceOfType(extension.Body))
{
return extension.Body;
}
But here is the strange thing: targetType.FullName = VG.Alarms.OpcUa.AcknoledgeEventUniqueIDType which is my type generated by ModelCompiler:
namespace VG.Alarms.OpcUa
{
#region AcknoledgeEventUniqueIDType Class
#if (!OPCUA_EXCLUDE_AcknoledgeEventUniqueIDType)
/// <summary>
/// A description for the AcknoledgeEventUniqueIDType DataType.
/// </summary>
/// <exclude />
[System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")]
[DataContract(Namespace = VG.Alarms.OpcUa.Namespaces.Alarms)]
public partial class AcknoledgeEventUniqueIDType : IEncodeable
...
But extension.Body.GetType().FullName = Opc.Ua.ComplexTypes.VG.Alarms.OpcUa.AcknoledgeEventUniqueIDType which is ... I don't know what, some mix of namespaces I guess.
Quickstart SimpleEvents Client from "UA Quickstart Applications" have the same issue with one exception: first 4 events can decode structure properly, afterwards it can't. Obviously it linked somehow to loading complex types from server. Everything works fine (structure event properties) if I remove following lines in client after session connection established:
var typeSystemLoader = new ComplexTypeSystem(m_session);
await typeSystemLoader.Load();
Hi.
I have custom structure and event:
Server works fine. It generates new event of type AcknoledgeNotificationEventType, client receives this event, it even receives my custom field EventUniqueID but it can not decode it and I get event's EventUniqueID.Value == null. This is my MonitoredItem Notification handler:
As I reviewed my e.NotificationValue.EventFields[10] is of type ExtensionObject. When it's value in tried to be resolved in BaseVariableState.DecodeExtensionObject it gets null. In BaseVariableState.DecodeExtensionObject only 2 values of Encoding property are handeled: Binary and Xml. My field comes with Encoding = EncodeableObject. This is the code how event is generated in server:
In Unified Automation UaExpert I can see my event's property EventUniqueID properly. What am I doing wrong?