{
object defaultValue = null;
- ConstructorInit(name, type, ConfigurationPropertyOptions.None, null, null);
+ ConstructorInit(name, type, ConfigurationPropertyOptions.None, null, null, null);
if (type == typeof(string))
{
ConfigurationPropertyOptions options,
string description)
{
- ConstructorInit(name, type, options, validator, typeConverter);
+ ConstructorInit(name, type, options, validator, typeConverter, description);
SetDefaultValue(defaultValue);
}
info.PropertyType,
propertyAttribute.Options,
validator,
- typeConverter);
+ typeConverter,
+ descriptionAttribute?.Description);
// Figure out the default value
InitDefaultValueFromTypeInfo(propertyAttribute, defaultValueAttribute);
-
- // Get the description
- if (!string.IsNullOrEmpty(descriptionAttribute?.Description))
- Description = descriptionAttribute.Description;
}
public string Name { get; private set; }
- public string Description { get; }
+ public string Description { get; private set; }
internal string ProvidedName { get; private set; }
Type type,
ConfigurationPropertyOptions options,
ConfigurationValidatorBase validator,
- TypeConverter converter)
+ TypeConverter converter,
+ string description)
{
if (typeof(ConfigurationSection).IsAssignableFrom(type))
{
}
Name = name;
+ Description = description;
Type = type;
_options = options;
Validator = validator;
Assert.IsType<DummyCanConverter>(property.Converter);
}
+ [Fact]
+ public void DescriptionValueIsExposed()
+ {
+ FooFailsValidator validator = new FooFailsValidator();
+ DummyCanConverter converter = new DummyCanConverter();
+ ConfigurationProperty property = new ConfigurationProperty("foo", typeof(MyConvertableClass), null, converter, validator, ConfigurationPropertyOptions.None, "bar");
+ Assert.Equal("bar", property.Description);
+ }
+
[TypeConverter(typeof(DummyCantConverter))]
public class MyUnconvertableClass
{