Skip to content

Commit b211712

Browse files
authored
more details for localized attribute properties... (#558)
If the resources are not visible the parser library throws a useless exception. These extra details help with finding the issue quicker.
1 parent 58e5391 commit b211712

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/CommandLine/Infrastructure/LocalizableAttributeProperty.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ private string GetLocalizedValue()
4545
{
4646
// Static class IsAbstract
4747
if (!_type.IsVisible)
48-
throw new ArgumentException("Invalid resource type", _propertyName);
48+
throw new ArgumentException($"Invalid resource type '{_type.FullName}'! {_type.Name} is not visible for the parser! Change resources 'Access Modifier' to 'Public'", _propertyName);
4949
PropertyInfo propertyInfo = _type.GetProperty(_value, BindingFlags.Public | BindingFlags.GetProperty | BindingFlags.Static);
5050
if (propertyInfo == null || !propertyInfo.CanRead || propertyInfo.PropertyType != typeof(string))
51-
throw new ArgumentException("Invalid resource property name", _propertyName);
51+
throw new ArgumentException("Invalid resource property name! Localized value: {_value}", _propertyName);
5252
_localizationPropertyInfo = propertyInfo;
5353
}
5454
return (string)_localizationPropertyInfo.GetValue(null, null);

0 commit comments

Comments
 (0)