peverify bugs fixed in .NET 4?

1

I have VS .NET 2010 installed, and a class library targeting .NET 3.5. The simple C# fragment below generates verifiable IL under .NET 4.0's peverify, but the IL does not verify using .NET 3.5's peverify.

Were there any peverify bugs fixed in this transition?

public static bool IsGenericTypeInstance(this Type typ)
{
    return typ.IsGenericType && !typ.IsGenericTypeDefinition;
}
public static IEnumerable<Type> GetAllGenericArguments(this Type type)
{
    return type.IsGenericTypeInstance()
         ? type.GetGenericArguments()
               .SelectMany(x => x.IsGenericTypeInstance()
                                ? GetAllGenericArguments(x)
                                : new[] { x })
         : Enumerable.Empty<Type>();
}

The error generated is:

Error   26  [Sasa.dll : Sasa.Types::<GetAllGenericArguments>b__0]
[offset 0x0000001C][found ref 'System.Collections.IEnumerable']
[expected ref 'System.Collections.Generic.IEnumerable`1[System.Type]']
Unexpected type on the stack.

I'm obviously a little concerned since I'm explicitly targeting .NET 3.5, and I don't want runtime verification errors on this platform.

clr
cil
peverify
asked on Stack Overflow Feb 24, 2012 by naasking

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0