diff --git a/src/BizHawk.Client.Common/Api/ApiInjector.cs b/src/BizHawk.Client.Common/Api/ApiInjector.cs
index 72727eae25..5f0587417a 100644
--- a/src/BizHawk.Client.Common/Api/ApiInjector.cs
+++ b/src/BizHawk.Client.Common/Api/ApiInjector.cs
@@ -35,7 +35,7 @@ namespace BizHawk.Client.Common
Type targetType = target.GetType();
object[] tmp = new object[1];
- targetType.GetProperties().FirstOrDefault(pi => pi.PropertyType == typeof(ApiContainer))
+ targetType.GetProperties(ReflectionExtensions.DI_TARGET_PROPS).FirstOrDefault(pi => pi.PropertyType == typeof(ApiContainer))
?.SetValue(target, source.Container);
foreach (var propinfo in targetType.GetPropertiesWithAttrib(typeof(RequiredApiAttribute)))
diff --git a/src/BizHawk.Common/Extensions/ReflectionExtensions.cs b/src/BizHawk.Common/Extensions/ReflectionExtensions.cs
index 6caef05ab0..94ea1ee650 100644
--- a/src/BizHawk.Common/Extensions/ReflectionExtensions.cs
+++ b/src/BizHawk.Common/Extensions/ReflectionExtensions.cs
@@ -11,15 +11,18 @@ namespace BizHawk.Common.ReflectionExtensions
///
public static class ReflectionExtensions
{
+ /// filter used when looking for [RequiredApi] et al. by reflection for dependency injection
+ public const BindingFlags DI_TARGET_PROPS = BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic;
+
public static IEnumerable GetPropertiesWithAttrib(this Type type, Type attributeType)
{
- return type.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic)
+ return type.GetProperties(DI_TARGET_PROPS)
.Where(p => p.GetCustomAttributes(attributeType, false).Length > 0);
}
public static IEnumerable GetMethodsWithAttrib(this Type type, Type attributeType)
{
- return type.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic)
+ return type.GetMethods(DI_TARGET_PROPS)
.Where(p => p.GetCustomAttributes(attributeType, false).Length > 0);
}