icsharpcode/ILSpy — Issue #287: Generics Params types not getting decompiled correctly
Author: skysigal
Created: 2011-11-04 08:02:29+00:00
State: open

Just gave it a first spin. Love where it's going! Definitely see a lot of use for it.

That said, did notice that v1.0 is decompiling some things incorrectly.

This:
private static void Initialize()
{
Type attributeType = typeof (DefaultServiceAttribute);
Type[] serviceTypes = AppDomain.CurrentDomain.GetTypesDecoratedWithAttributes(attributeType);
foreach (Type serviceType in serviceTypes)
{
var defaultServiceAttribute =
serviceType.GetAttribute(false);

_container.Register(defaultServiceAttribute.ServiceInterface, serviceType);
}
}

got decompiled to:

private static void Initialize()
{
Type typeFromHandle = typeof(DefaultServiceAttribute);
Type[] typesDecoratedWithAttributes = AppDomain.CurrentDomain.GetTypesDecoratedWithAttributes(typeFromHandle, true);
Type[] array = typesDecoratedWithAttributes;
for (int i = 0; i < array.Length; i++)
{
Type type = array[i];
DefaultServiceAttribute attribute = type.GetAttribute(false);
ServiceLocatorService._container.Register(attribute.ServiceInterface, type, null, false, false);
}
}

losing its generic Type info in the GetAttribute method.

Again, thanks for all the hard work. Really fantastic.