Hello,
I'm currently using Reflection.Emit and I'm sick to death making workarounds for its strange behaviours.
Currently I'm stuck trying to generate a certain class. Using C# notation, it would look like this:
class A
{
public List<A> MakeList()
{
return new List<A>();
}
}
The trick is, Reflection.Emit allows calling any introspection methods on neither dynamically generated types, nor any generic types using those dynamic types as generic arguments.
Therefore to generate the method body I would need to get a constructor from List<A>, and to get the constructor I need to finalize A, which in turn would render getting the constuctor useless.
Luckily, Reflection.Emit provides some static methods which can actually return the desired constructor. However, using this method the return type and argument types are all mangled.
Can Mono.Cecil emit code for this class out of the box?