VS .NET 2010をインストールし、.NET3.5を対象としたクラスライブラリをインストールしました。以下の単純なC#フラグメントは、.NET 4.0のpeverifyで検証可能なILを生成しますが、ILは.NET3.5のpeverifyを使用して検証しません。
この移行で修正されたpeverifyのバグはありましたか?
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>();
}
生成されるエラーは次のとおりです。
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.
明示的に.NET3.5をターゲットにしているので、明らかに少し心配しています。このプラットフォームでランタイム検証エラーが発生することは望ましくありません。