From 2a4ba56e079b317aae6fd10de158daada1453191 Mon Sep 17 00:00:00 2001 From: Markus Horstmann Date: Wed, 10 May 2023 15:42:02 -0700 Subject: [PATCH] JsonDecoder: actually return json for ExtensionObjects --- Stack/Opc.Ua.Core/Types/Encoders/JsonDecoder.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Stack/Opc.Ua.Core/Types/Encoders/JsonDecoder.cs b/Stack/Opc.Ua.Core/Types/Encoders/JsonDecoder.cs index 17bad5a3d2..014b5ee1af 100644 --- a/Stack/Opc.Ua.Core/Types/Encoders/JsonDecoder.cs +++ b/Stack/Opc.Ua.Core/Types/Encoders/JsonDecoder.cs @@ -1450,8 +1450,9 @@ namespace Opc.Ua using (JsonTextWriter writer = new JsonTextWriter(stream)) { EncodeAsJson(writer, token); - return new ExtensionObject(typeId, ostrm.ToArray()); } + // Close the writer before retrieving the data + return new ExtensionObject(typeId, ostrm.ToArray()); } finally { @@ -1463,7 +1464,7 @@ namespace Opc.Ua /// Reads an encodeable object from the stream. /// /// The encodeable object field name - /// The system type of the encopdeable object to be read + /// The system type of the encodeable object to be read /// The TypeId for the instance that will be read. /// An object that was read from the stream. public IEncodeable ReadEncodeable(string fieldName, System.Type systemType, ExpandedNodeId encodeableTypeId = null)