Washi1337 / OldRod

An automated KoiVM disassembler and devirtualisation utility
GNU General Public License v3.0
350 stars 80 forks source link

Fix TypeReferences emitted by OldRod using incorrect CorLib. #49

Closed ElektroKill closed 2 years ago

ElektroKill commented 2 years ago

The previous method would create references to netstndard instead of mscorlib for .NET Framework executables.

This does not prevent this problem from occurring when injecting the VmHelper type since the importing there is done by AsmResolver and it doesn't offer any way to easily change these references to the correct core library when injecting. In theory, OldRod could iterate over the injected members to patch the references but that seems rather hacky.

Washi1337 commented 2 years ago

This is currently a limitation of AsmResolver (Related Washi1337/AsmResolver#93, and https://asmresolver.readthedocs.io/en/latest/dotnet/importing.html#common-caveats-using-the-importer).

Needless to say, referencing netstandard is fine in an application that targets .NET framework 4.6 or higher.

ElektroKill commented 2 years ago

Yes, for .NET Framework 4.6, netstandard references should be fine but for lower frameworks like the ancient 2.0 or 3.5 it may cause issues which is why I made this partial fix.

Washi1337 commented 2 years ago

Not sure if this is a viable "partial" solution then. Best to tackle this problem at its core rather than trying to bandage some unwanted side-effects that still do not really remove all references to netstandard.

Washi1337 commented 2 years ago

Sorry for the very late response. Thanks for adding it to oldrod!