SMAPI - Stardew Modding API

SMAPI - Stardew Modding API

971k Downloads

Assembly references in attributes aren't rewritten for Windows <-> Mono

spacechase0 opened this issue ยท 5 comments

commented

An example of this is [HarmonyPatch], which requires the type of the object patched. (See spacechase0/SpaceCore_SDV#2)

commented

I got the test mod working on Windows. Ultimately, AssemblyDefinition.GetTypeReferences() doesn't get everything.

More specifically, it doesn't get the CustomAttributeArgument TypeReferences. I'm not sure why on a low-level though - perhaps they're not stored in the main table of the file format or something.

As things are right now, if you set a breakpoint here, the game breaks only once with the test mod. With my changes, it breaks twice.

commented

@spacechase0 Tested with ChefRude on Discord per discussion. It's almost working but currently fails on Mac (see log).

commented

I have no current plans to implement this, so I'm shelving this. I'd be open to considering a pull request to fix it, though.

commented

This may be a bug in Mono.Cecil (or in the way SMAPI uses it). SMAPI correctly detects and rewrites the type reference, but the rewrite seems to have no effect in the case of custom attributes.

I'm mainly focused on updating mods to SMAPI 2.0 for the next couple of months, so I'll put a bounty on this ticket in the meantime: US$40 to the person who submits an accepted pull request which fixes the issue. (Here's a mod which reproduces the error when run on Windows.) :)

commented

Done in SMAPI 3.6 via the changes in #711.