summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-06-03 19:02:24 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-06-03 19:02:24 -0400
commit43a9ee42aac1eaf2ff630d164bc425718a531a64 (patch)
tree07f891a26429d7e31596aad175e9a51e86e4760a
parent80f882baf3f1854e32df3546fc4d4485c2aab68f (diff)
downloadSMAPI-43a9ee42aac1eaf2ff630d164bc425718a531a64.tar.gz
SMAPI-43a9ee42aac1eaf2ff630d164bc425718a531a64.tar.bz2
SMAPI-43a9ee42aac1eaf2ff630d164bc425718a531a64.zip
don't prevent mods from accessing game methods/properties extended by SMAPI
-rw-r--r--docs/release-notes.md1
-rw-r--r--src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs5
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;
}