urasandesu / Prig

Prig is a lightweight framework for test indirections in .NET Framework.
Other
117 stars 21 forks source link

The method of generic type that has declaring type parameter excluding this cannot detour #85

Closed urasandesu closed 7 years ago

urasandesu commented 7 years ago

A method that has the following characteristics cannot detour:

For example, the following method is that:

public class C<Bar>
{
    public void Fuga(C<Bar> result)
    {
        throw new InvalidOperationException("We shouldn't get here!!");
    }
}

In the managed code, we cannot make the generic type instance that is instantiated by its generic parameter. For example, typeof(Nullable<>).MakeGenericType(typeof(Nullable<>).GetGenericArguments()[0]) is treated same as Nullable<>.

Against this parameter, we have already treated in such way. We should apply the way to all parameters.