Index: Core/Common/src/Core.Common.Gui/Converters/KeyValueAsRoundedDoubleWithoutTrailingZeroesElementAttribute.cs =================================================================== diff -u -r7ce1153d6af94b372e527cfb2c9128924e340a4f -r1ccc9e6a5966ece15014631f831604eb6058dc2c --- Core/Common/src/Core.Common.Gui/Converters/KeyValueAsRoundedDoubleWithoutTrailingZeroesElementAttribute.cs (.../KeyValueAsRoundedDoubleWithoutTrailingZeroesElementAttribute.cs) (revision 7ce1153d6af94b372e527cfb2c9128924e340a4f) +++ Core/Common/src/Core.Common.Gui/Converters/KeyValueAsRoundedDoubleWithoutTrailingZeroesElementAttribute.cs (.../KeyValueAsRoundedDoubleWithoutTrailingZeroesElementAttribute.cs) (revision 1ccc9e6a5966ece15014631f831604eb6058dc2c) @@ -60,15 +60,15 @@ throw new ArgumentException($"Name property '{namePropertyName}' was not found on type {source.GetType().Name}."); } - PropertyInfo unitPropertyInfo = GetUnit(source); + PropertyInfo unitPropertyInfo = GetUnitPropertyInfo(source); - object propertyInfoObject = unitPropertyInfo.GetValue(source, new object[0]); - if (propertyInfoObject == null) + object unit = unitPropertyInfo.GetValue(source, new object[0]); + if (unit == null) { - return base.GetName(source); + throw new ArgumentNullException(nameof(unit)); } - return $"{Convert.ToString(namePropertyInfo.GetValue(source, new object[0]))} [{Convert.ToString(propertyInfoObject)}]"; + return $"{Convert.ToString(namePropertyInfo.GetValue(source, new object[0]))} [{Convert.ToString(unit)}]"; } /// @@ -99,7 +99,15 @@ return doubleValue.ToString("0.#####", CultureInfo.CurrentCulture); } - private PropertyInfo GetUnit(object source) + /// + /// Gets the unit property info from the . + /// + /// The source to obtain the unit property info of. + /// The of the property. + /// Thrown when the property used for the unit of + /// the is not found on the . + /// + private PropertyInfo GetUnitPropertyInfo(object source) { PropertyInfo unitPropertyInfo = source.GetType().GetProperty(unitPropertyName); if (unitPropertyInfo == null)