API instance can't be non-public
spacechase0 opened this issue ยท 5 comments
Fixed in develop
for the upcoming SMAPI 2.5. The error happened because your API is marked internal
, so SMAPI's proxy class couldn't access it. SMAPI will now rewrite all mod DLLs to inject an [InternalsVisibleTo("StardewModdingAPI.Proxies")]
attribute.
I played around with using DynamicMethod
to bypass visibility checks in the IL-generated proxy class, but I'm shelving this for now. Instead I'll mark it a known issue and validate that the target type is public
until we can address this.
I wonder if it's possible to emit a proxy class for the API into the mod's assembly at runtime that's marked as public?