← 输入框|github.com|刷新
Skip to content

MonoMod cannot map dependency mscorlib.dll #103

Open

Description

@Iikorni

Description

This is likely a bit of a stupid question, but I'm having trouble doing a test patch to a game using MonoMod. I'm on a MacBook (M1), with an x64 version of the .NET SDK (5.0.408/5.0.17). I'm able to generate a rudimentary patch of an XNA Game1, following all the instructions, with one caveat - MonoMod.exe isn't recognized as a valid assembly Rider, so I'm unable to link to it, although MonoMod.dll works fine. Upon running dotnet MonoMod.dll <game_lib>.dll, I get the following error:

MonoMod.Utils.RelinkTargetNotFoundException: MonoMod cannot map dependency mscorlib.dll -> ((System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51), (System.Security.Permissions)) - not found
   at MonoMod.MonoModder.DefaultMissingDependencyResolver(MonoModder mod, ModuleDefinition main, String name, String fullName)
   at MonoMod.MonoModder.MapDependency(ModuleDefinition main, String name, String fullName, AssemblyNameReference depRef)
   at MonoMod.MonoModder.MapDependencies(ModuleDefinition main)
   at MonoMod.MonoModder.MapDependency(ModuleDefinition main, String name, String fullName, AssemblyNameReference depRef)
   at MonoMod.MonoModder.MapDependencies(ModuleDefinition main)
   at MonoMod.MonoModder.MapDependency(ModuleDefinition main, String name, String fullName, AssemblyNameReference depRef)
   at MonoMod.MonoModder.MapDependencies(ModuleDefinition main)
   at MonoMod.MonoModder.MapDependency(ModuleDefinition main, String name, String fullName, AssemblyNameReference depRef)
   at MonoMod.MonoModder.MapDependency(ModuleDefinition main, AssemblyNameReference depRef)
   at MonoMod.MonoModder.MapDependencies(ModuleDefinition main)
   at MonoMod.MonoModder.MapDependencies()
   at MonoMod.Program.Main(String[] args)

The game I'm trying to patch includes a version of mscorlib.dll with it, and I've tried having my mod directly linked against it, with no luck.

Am I missing something obvious? I've considered the fact it's an M1 mac, and that support is still awaited for it, but I (possibly naively) assumed that Rosetta would pick up the slack if the entire base of the .NET installation was x64.

If this information isn't enough, I'll try to provide everything I can if it can lead to getting this working.

Activity

  1. Iikorni commented on Feb 9, 2023

    @Iikorni
    Author

    For full clarity, although there's been no response, I've also encountered this on Windows, so perhaps it's something wrong with the way I'm setting this all up? I'm still trying to target .NET 5.0.

  2. nike4613 commented on Feb 11, 2023

    @nike4613
    Member

    I brought this up in the Discord, and the response was basically this: the patcher is kinda bad, and uses the decidedly bad Cecil to try to do its work. It struggles (i.e. cannot reliably) remap Framework binaries from Core.

    That being said, it may be possible to coerce it to behave despite that, but that'll probably require some hacks. At some point, we'd like to rewrite the patcher (and the rest of MonoMod) to be based on a more modern .NET metadata library like AsmResolver, but that has not happened just yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions