From 34bb611958e62584927cf8a6bde4bd2dca17802e Mon Sep 17 00:00:00 2001 From: Alexandru Dicu Date: Mon, 25 Sep 2017 11:36:24 +0300 Subject: [PATCH] Utils.Clone() bug (#249) Steps to reproduce: Create a variable instance of DataType = Opc.Ua.TimeZoneDataType Read the variable Actual result: Opc.Ua.Utils.Clone() throws exception because the cast to Opc.Ua.TimeZoneDataType is not supported. Expected result: Variable instance of DataType = Opc.Ua.TimeZoneDataType can be read. --- Stack/Opc.Ua.Core/Types/Utils/Utils.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Stack/Opc.Ua.Core/Types/Utils/Utils.cs b/Stack/Opc.Ua.Core/Types/Utils/Utils.cs index ea8ed0f7ac..552e26a55e 100644 --- a/Stack/Opc.Ua.Core/Types/Utils/Utils.cs +++ b/Stack/Opc.Ua.Core/Types/Utils/Utils.cs @@ -1731,7 +1731,15 @@ namespace Opc.Ua { return castedObject.MemberwiseClone(); } - } + } + // copy Opc.Ua.TimeZoneDataType + { + TimeZoneDataType castedObject = value as TimeZoneDataType; + if (castedObject != null) + { + return castedObject.MemberwiseClone(); + } + } // don't know how to clone object. throw new NotSupportedException(Utils.Format("Don't know how to clone objects of type '{0}'", type.FullName));