-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Looks like I found a small bug in the MNTR here:
private IEnumerable<RoleName> RoleNames(Type specType)
{
var ctorWithConfig = FindConfigConstructor(specType);
var configType = ctorWithConfig.GetParameters().First().ParameterType;
var args = ConfigConstructorParamValues(configType);
var configInstance = Activator.CreateInstance(configType, args);
var roleType = typeof(RoleName);
var configProps = configType.GetProperties(BindingFlags.Instance | BindingFlags.Public);
var roleProps = configProps.Where(p => p.PropertyType == roleType && p.Name != "Myself").Select(p => (RoleName)p.GetValue(configInstance));
var configFields = configType.GetFields(BindingFlags.Instance | BindingFlags.Public);
var roleFields = configFields.Where(f => f.FieldType == roleType && f.Name != "Myself").Select(f => (RoleName)f.GetValue(configInstance));
var roles = roleProps.Concat(roleFields).Distinct();
return roles;
}
This can only find RoleName
s that have been declared as fields on an MNTR config - any code that dynamically returns a number of Roles, such as the StressSpec
, will not run. I'll have to patch this also.
Originally posted by @Aaronontheweb in #4899 (comment)