C# Client: Reading UDT only returns Byte Array|OPC UA Implementation: Stacks, Tools, and Samples|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
C# Client: Reading UDT only returns Byte Array
Avatar
Mirko
Neumünster, Germany
New Member
Members
Forum Posts: 2
Member Since:
05/29/2018
sp_UserOfflineSmall Offline
1
09/03/2023 - 23:42
sp_Permalink sp_Print

I am developing a C# Application with the .NET Stack (.NET 6). I am trying to read UDTs from a Siemens PC OPC UA server. I followed the Sample in the C# project UA Sample Applications but I have the problem, that the DataValueCollection returned only contains a Byte array. When I use the sample client I get an array with the nested values. What do I have to do to read the data in the same structured way as the sample application? Below you can see the debug information from the breakpoint in the sample application and from my application. You can see the difference in the debug information.

UA Sample Client:

uasampleapplicationsvgcfp.pngImage Enlarger

My Client:

myclientuaf7d.pngImage Enlarger

 

Currently I have no idea how to solve that. Is there a method that I have to call in advance to let the server know that I want to have structured data?

Do I need to download some UDT definitions to the client in advance? Are there any points that I am missing?

If more information is needed please let me know. 

Avatar
Mirko
Neumünster, Germany
New Member
Members
Forum Posts: 2
Member Since:
05/29/2018
sp_UserOfflineSmall Offline
2
09/04/2023 - 06:03
sp_Permalink sp_Print

In case anybody has the same problem:

You need to add reference to the nuget package Opc.Ua.Client.ComplexTypes. Then you need to add following lines after session is created:

var typeSystemLoader = new ComplexTypeSystem(OpcUaSession);
typeSystemLoader.Load().Wait();

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 17
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1423
Posts: 4813