Fix `ApiInjector` trying to set get-only props of type `ApiContainer`

This commit is contained in:
YoshiRulz 2023-01-08 08:26:27 +10:00
parent 16ee704332
commit 3c00c24fcd
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 6 additions and 2 deletions

View File

@ -35,8 +35,12 @@ namespace BizHawk.Client.Common
Type targetType = target.GetType();
object[] tmp = new object[1];
targetType.GetProperties(ReflectionExtensions.DI_TARGET_PROPS).FirstOrDefault(pi => pi.PropertyType == typeof(ApiContainer))
?.SetValue(target, source.Container);
foreach (var mi in targetType.GetProperties(ReflectionExtensions.DI_TARGET_PROPS)
.Where(static pi => pi.PropertyType == typeof(ApiContainer))
.Select(static pi => pi.SetMethod))
{
mi?.Invoke(target, new object[] { source.Container });
}
foreach (var propinfo in targetType.GetPropertiesWithAttrib(typeof(RequiredApiAttribute)))
{