Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MonoMod cannot map dependency mscorlib.dll #103

Open
Iikorni opened this issue Sep 4, 2022 · 2 comments
Open

MonoMod cannot map dependency mscorlib.dll #103

Iikorni opened this issue Sep 4, 2022 · 2 comments
Labels

Comments

@Iikorni
Copy link

Iikorni commented Sep 4, 2022

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.

@Iikorni Iikorni added the bug label Sep 4, 2022
@Iikorni
Copy link
Author

Iikorni commented Feb 9, 2023

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.

@nike4613
Copy link
Contributor

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
Labels
Projects
None yet
Development

No branches or pull requests

2 participants