OPCFoundation / UA-.NETStandard

OPC Unified Architecture .NET Standard
Other
1.97k stars 950 forks source link

Writing Complex Types #2826

Open KircMax opened 3 weeks ago

KircMax commented 3 weeks ago

Type of issue

Current Behavior

I have some issues with writing some complex types: The most simple write that failed that I found now was this one: image The node looks like this: image The read worked fine. AdditionalInfo of InnerResult:

Cannot encode bodies of type 'Opc.Ua.ComplexTypes..10.IEC_COUNTER' in ExtensionObject unless the NamespaceUri (http://asm_dynamicarray/) is in the encoder's NamespaceTable. --- bei Opc.Ua.BinaryEncoder.WriteExtensionObject(String fieldName, ExtensionObject value) --- bei Opc.Ua.BinaryEncoder.WriteExtensionObjectArray(String fieldName, IList1 values) --- bei Opc.Ua.BinaryEncoder.WriteVariantValue(String fieldName, Variant value) --- bei Opc.Ua.BinaryEncoder.WriteVariant(String fieldName, Variant value) --- bei Opc.Ua.BinaryEncoder.WriteDataValue(String fieldName, DataValue value) --- bei Opc.Ua.WriteValue.Encode(IEncoder encoder) --- bei Opc.Ua.BinaryEncoder.WriteEncodeable(String fieldName, IEncodeable value, Type systemType) --- bei Opc.Ua.BinaryEncoder.WriteEncodeableArray(String fieldName, IList1 values, Type systemType) --- bei Opc.Ua.WriteRequest.Encode(IEncoder encoder) --- bei Opc.Ua.BinaryEncoder.WriteEncodeable(String fieldName, IEncodeable value, Type systemType) --- bei Opc.Ua.BinaryEncoder.EncodeMessage(IEncodeable message) --- bei Opc.Ua.BinaryEncoder.EncodeMessage(IEncodeable message, Stream stream, IServiceMessageContext context, Boolean leaveOpen) --- bei Opc.Ua.Bindings.UaSCUaBinaryChannel.WriteSymmetricMessage(UInt32 messageType, UInt32 requestId, ChannelToken token, Object messageBody, Boolean isRequest, Boolean& limitsExceeded) --- bei Opc.Ua.Bindings.UaSCUaBinaryClientChannel.SendRequest(WriteOperation operation, Int32 timeout, IServiceRequest request)

Result | {BadEncodingError 'Could not send request to server.'} | Opc.Ua.ServiceResult

bei Opc.Ua.Bindings.ChannelAsyncOperation`1.End(Int32 timeout, Boolean throwOnError) in Opc.Ua.Bindings\ChannelAsyncOperation.cs: Zeile218

bei Opc.Ua.Bindings.UaSCUaBinaryClientChannel.EndSendRequest(IAsyncResult result) in Opc.Ua.Bindings\UaSCUaBinaryClientChannel.cs: Zeile280 bei Opc.Ua.SessionClient.Write(RequestHeader requestHeader, WriteValueCollection nodesToWrite, StatusCodeCollection& results, DiagnosticInfoCollection& diagnosticInfos) in Opc.Ua\SessionClient.cs: Zeile1373 bei Opc.Ua.SessionClientBatched.Write(RequestHeader requestHeader, WriteValueCollection nodesToWrite, StatusCodeCollection& results, DiagnosticInfoCollection& diagnosticInfos) in Opc.Ua\SessionClientBatched.cs: Zeile472

Expected Behavior

Sending the WriteRequest works fine

Steps To Reproduce

I probably will have to provide a repro in a sample server/client combination, right?

Environment

- OS: Windows 10 22H2 Build 19045.5011
- Environment: Windows 10
- Runtime: 
- Nuget Version: 1.5.374.126
- Component: Opc.Ua.BinaryEncoder
- Server: S7-1500
- Client: SessionClientBatched (Opc.Ua)

Anything else?

No response