Repository navigation
Type of issue
Current BehaviorTo summarize: I can't write a custom datatype to the server, because I get a BadTypeMismatch. In more detail:
Additional info: Code: From the Program.cs code: Additionally, here are the Variable and Type definition: Thank you for your help :) Expected BehaviorThe behavior I expect is to be able to write to a custom datatype on the server, or at least to it's fields. Steps To ReproduceNo response Environment- OS: Windows 11
- Environment: Visual Studio 2022 17.6.2
- Runtime:.NET 4.8.04161
- Nuget Version: 6.6.0
- Component: Opc.Ua
- Server: Custom as in https://github.com/OPCFoundation/UA-.NETStandard/blob/master/Applications/ConsoleReferenceServer/UAServer.cs
- Client: Custom as in https://github.com/OPCFoundation/UA-.NETStandard/blob/master/Applications/ConsoleReferenceClient/UAClient.csAnything else?I also tried various different approaches:
a) here I then first tried something similar to #790 (the constructor creates new instance with FieldName initializes to 0): b) Then I thought I might need to make use of the Encoding, thus I changed it to: c) I also tried to manually recreating the value:
|
Replies: 2 comments
|
I was able to get it to write to the server. From the Program.cs I can also get the value back and decode the bytes to the type. Both write and read have StatusCode Good. |
|
There are two separate problems here. 1. BadTypeMismatch on write-back (1.5.x). The initial value in your NodeSet has 2. Clients failing after the write ("Unable to read beyond the end of the stream", On the client, the easiest way to get this right is to let the stack build the type from the server's definition instead of hand-encoding it. Use On the server side, 2.0 builds encodeable stand-ins at startup for every DataType with a Closing as answered. If it still fails on 2.0 with a correctly wired NodeSet, please open an issue with the NodeSet and a small client snippet. |
There are two separate problems here.
1. BadTypeMismatch on write-back (1.5.x). The initial value in your NodeSet has
<uax:TypeId>set to the DataType NodeId (ns=idx2;s=path.to.datatype). The TypeId of an ExtensionObject must be the encoding NodeId (Default Binary/Default XML, yoursomeIdx/someOtherIdx). When you write that value back, the 1.5 server tries to map the TypeId to a DataType through theHasEncodingreferences. The DataType id itself is not an encoding, so the check against the variable's DataType fails. The same applies to yourEncodeableObjectattempt ifXmlEncodingId/BinaryEncodingIddo not resolve to those nodes in the server's namespace table. Fix the NodeSet value to u…