Lokad / ILPack

Serialize .NET Core assemblies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support generic method parameters

vermorel opened this issue · comments

ILPack appears to fail at processing types that contains methods with generic parameters. The unit tests RewriteTest.AssemblyName fails with:

 System.TypeInitializationException : The type initializer for 'Lokad.ILPack.Tests.RewriteTest' threw an exception. 
 ---- System.ArgumentException : Type cannot be found: "T" of "TestSubject.MyClass, TestSubject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"

Parameter name: type

Yet, attempting to solve the problem by adding the following lines to AssemblyGenerator.Types.cs :

foreach (var inf in type.GetMethods().SelectMany(t => t.GetGenericArguments()))
{
    yield return inf;
}

Generates the exception:

System.TypeInitializationException : The type initializer for 'Lokad.ILPack.Tests.RewriteTest' threw an exception. 
---- System.ArgumentException : Cyclic connections are not allowed

It look like you picked up the fix for this. You should be getting green lights across the board for the unit tests now?

Yes, everything green now. Awesome!