-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Type of issue
- Bug
- Enhancement
- Compliance
- Question
- Help wanted
Current Behavior
Using the ConsoleReferencePublisher, when sending messages with "DataSetFieldContentMask.RawData" (this is currently used by default), setting a MaxStringLength value for the "String" variable, does not lead to messages of consistent length.
Using WireShark we can see the message length is dependent on the length of the actual string:

The payload is not padded to the configured MaxStringLengthValue, it ends immediately:

Expected Behavior
Whenever DataSetFieldContentMask.RawData is used, a MaxStringLengthValue should be mandatory and messages should be padded to the maximum expected size.
Steps To Reproduce
- Adjust Applications/ConsoleReferencePublisher/Program.cs:
- in CreatePublisherConfiguration_UdpUadp, set Enabled = "false" for dataSetWriter1 as we are not interested in this writer:
var dataSetWriter1 = new DataSetWriterDataType
{
Name = "Writer 1",
DataSetWriterId = 1,
Enabled = false,
DataSetFieldContentMask = (uint)DataSetFieldContentMask.RawData,
DataSetName = "Simple",
KeyFrameCount = 1
};- in CreatePublishedDataSetAllTypes, remove all FieldMetaData except "String" and add "MaxStringLength = 10" to this FieldMetaData:
new FieldMetaData
{
Name = "String",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte)DataTypes.String,
DataType = DataTypeIds.String,
ValueRank = ValueRanks.Scalar,
MaxStringLength = 10
}- Start the Publisher:
dotnet run --project ConsoleReferencePublisher.csproj --framework net10.0 -u- Observe payload lengths with Wireshark:
- The payload lengths are dependent on the length of the string length and not padded to the max. length
Environment
- OS: Linux Mint Debian Edition 7
- Environment: VS Code 1.109.3
- Runtime: .NET 10.0
- Nuget Version: 1.5.378.106
- Component: Opc.Ua.PubSub
- Server: -
- Client: ConsoleReferencePublisherAnything else?
The expected behaviour is specified here: https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.4.5.11
The ConsoleReferenceSubscriber is still able to decode these message fine.
This did however lead to decoding errors on subscribers built on another stack.