SMAPI - Stardew Modding API

SMAPI - Stardew Modding API

971k Downloads

API instance can't be non-public

spacechase0 opened this issue ยท 5 comments

commented

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.

commented

I reverted the previous fix since that would break debugging support.

commented

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.

commented

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?

commented

This ticket is stale, I have no plans to add support for internal classes in the near future, and it's documented as a requirement for exposing an API. A pull request is welcome if someone wants to contribute an implementation though.