il-repack: Repacking Harmony in Debug mode fails
Hi,
my open source project Harmony uses this task to pack its “Fat” releases. It works fine but we discovered that the “DebugFat” release does not work on .NET 5 or newer. Packing itself isn’t the problem because ReleaseFat works just fine.
The problem is very easy to replicate by cloning the project (master) and running tests for DebugFat and ReleaseFat.
There is an active discussion going on on my discord server where the guys from the MonoMod.Core project (a dependency Harmony has) discuss that this is related to them using some function pointer here which matches the exception I get when running/testing DebugFat:
System.TypeLoadException : Could not load type 'CORINFO_METHOD_INFO' from assembly 'System.Runtime.Serialization.Formatters, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
which is also randomly giving other assemblies (so not related to System.Runtime.Serialization.Formatters at all).
Quote from @nike4613 in the discord:
- InvokeCompileMethod there is a property which returns a function pointer, which is immediately invoked
- this is emitted as a calli
- you’ll notice, one of the parameters is a V21.CORINFO_METHOD_INFO*
- i think that the repacker is messing up the calli signature in exactly the same way that monomod’s calli emitter was
- so one way or another, the sig asks for CORINFO_METHOD_INFO, but that somehow has the wrong ‘context’ token
If you want to discuss this issue, you are welcome to temporarily join my discord server. The channel is called harmony-contributors.
Reference to original post: https://github.com/ravibpatel/ILRepack.Lib.MSBuild.Task/issues/49#issuecomment-2019474516
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 15
Commits related to this issue
- Fix parameter types for Calli callsites Fixes #355 — committed to mensalzb/il-repack by KirillOsenkov 3 years ago
my bad, everything works as expected
Published https://www.nuget.org/packages/ILRepack/2.0.29 and https://www.nuget.org/packages/ILRepack.Lib/2.0.29
checkbinarycompat is a tool I wrote to resolve all assembly refs, type refs and member refs and ensure they are present in the referenced assembly: https://www.nuget.org/packages/checkbinarycompat#readme-body-tab
OK here’s the fix for the build to not require all the .NET Core SDKs installed: https://github.com/pardeike/Harmony/pull/604