pardeike / Harmony

A library for patching, replacing and decorating .NET and Mono methods during runtime
https://www.patreon.com/pardeike
MIT License
5.15k stars 485 forks source link

Could not load type 'CORINFO_METHOD_INFO' from assembly 'System.Text.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. #616

Closed chinware closed 2 months ago

chinware commented 2 months ago

image

.NET 8 windows 11

The above error is reported when debugging rider, but everything is normal when running in rider。

chinware commented 2 months ago

lib.harmony 2.3.3 has this problem, but lib.harmony.thin has no problem and everything works fine.

nvirth commented 1 week ago

Same issue here. Edit: Oh I see now this issue is closed. Since no new release of this lib came out since March, i guess this will be fixed when a version newer than 2.3.3 comes out?

davidnemeti commented 1 week ago

Why has this issue been closed?

pardeike commented 1 week ago

This earlier comment explains it: https://github.com/pardeike/Harmony/issues/616#issuecomment-2196199309

nvirth commented 1 week ago

So there is no fix? For some reason, the .Thin version does not work for me - there was an inexplicable build error if I changed to the .Thin, and also the docs says using the other version is the recommended way, so I rolled back to the normal version. But now I'm stuck :(

pardeike commented 1 week ago

The thin version is exactly what you need. It leave dependency management to you and the error, as described in this topic, is clearly hinting about it. You have a runtime dependency problem which needs to be solved by you, not Harmony.

The reason this issue is closed is because Harmony does nothing wrong. If your dependencies conflict with the fat (normal) version it’s because it merges conveniently dependencies into one dll but that does not work for everyone. Therefore the thin version exists but leaves it up to the user to make sure the required types are available at runtime.