diff options
-rw-r--r-- | docs/release-notes.md | 1 | ||||
-rw-r--r-- | src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md index b2ef5a8d..55339d57 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -25,6 +25,7 @@ * Improved mod rewriting for compatibility: * Fixed rewriting types in custom attributes. * Fixed rewriting generic types to method references. + * Fixed `helper.Reflection` blocking access to game methods/properties that were extended by SMAPI. * Fixed asset propagation for Gil's portraits. * Fixed `.pdb` files ignored for error stack traces for mods rewritten by SMAPI. diff --git a/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs b/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs index 86c327ed..916c215d 100644 --- a/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs @@ -122,7 +122,8 @@ namespace StardewModdingAPI.Framework.ModHelpers /// <returns>Returns the same property instance for convenience.</returns> private IReflectedProperty<T> AssertAccessAllowed<T>(IReflectedProperty<T> property) { - this.AssertAccessAllowed(property?.PropertyInfo); + this.AssertAccessAllowed(property?.PropertyInfo.GetMethod?.GetBaseDefinition()); + this.AssertAccessAllowed(property?.PropertyInfo.SetMethod?.GetBaseDefinition()); return property; } @@ -131,7 +132,7 @@ namespace StardewModdingAPI.Framework.ModHelpers /// <returns>Returns the same method instance for convenience.</returns> private IReflectedMethod AssertAccessAllowed(IReflectedMethod method) { - this.AssertAccessAllowed(method?.MethodInfo); + this.AssertAccessAllowed(method?.MethodInfo.GetBaseDefinition()); return method; } |