Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions NodeSetToAML.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2541,11 +2541,14 @@ private void SetArrayDimensions( AttributeSequence attributes, string arrayDimen
}
}

AddModifyAttribute( attributes,
"ArrayDimensions",
Opc.Ua.DataTypeIds.UInt32,
new Variant( arrayValues.ToArray() ),
bListOf: true );
if (arrayValues.Count > 0)
{
AddModifyAttribute(attributes,
"ArrayDimensions",
Opc.Ua.DataTypeIds.UInt32,
new Variant(arrayValues.ToArray()),
bListOf: true);
}
}

#endregion
Expand Down
13 changes: 8 additions & 5 deletions SystemTest/TestMultiDimensionalArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ public void TestArray( string nodeId, string valueRank, string arrayDimensions,
Assert.AreEqual( valueRank, valueRankAttribute.Value );

AttributeType arrayDimensionsAttribute = objectToTest.Attribute[ "ArrayDimensions" ];
Assert.IsNotNull( arrayDimensionsAttribute, "Unable to find ArrayDimensions" );
if( arrayDimensions.Length == 0 )
if (string.IsNullOrEmpty(arrayDimensions))
{
Assert.IsNull( arrayDimensionsAttribute.Value );
Assert.IsNull(arrayDimensionsAttribute);
}
else
{
Assert.IsNotNull(arrayDimensionsAttribute, "Unable to find ArrayDimensions");
}

AttributeType valueAttribute = objectToTest.Attribute[ "Value" ];
Expand Down Expand Up @@ -100,10 +103,10 @@ public void TestMethodClassAttributes()

[TestMethod, Timeout( TestHelper.UnitTestTimeout )]
[DataRow( "2330", "", false, true, DisplayName = "SUC HistoryServerCapabilitiesType should not have ArrayDimensions" )]
[DataRow( "24186", "", true, true, DisplayName = "SUC FailureCode should have empty ArrayDimensions" )]
[DataRow( "24186", "", false, true, DisplayName = "SUC FailureCode should not have ArrayDimensions" )]
[DataRow( "24187", "0,8", true, true, DisplayName = "SUC FailureSystemIdentifier ArrayDimensions" )]
[DataRow( "5013", "", false, false, DisplayName = "Folder should not have ArrayDimensions" )]
[DataRow( "6190", "", true, false, DisplayName = "Scalar Value should not have ArrayDimension elements" )]
[DataRow( "6190", "", false, false, DisplayName = "Scalar Value should not have ArrayDimension elements" )]
[DataRow( "6126", "10", true, false, DisplayName = "Single ArrayDimension element" )]
[DataRow( "6129", "3,3,3", true, false, DisplayName = "Three ArrayDimension elements" )]
[DataRow( "6128", "2,2,2,2,2", true, false, DisplayName = "Five ArrayDimension elements" )]
Expand Down