Found while writing characterization tests before starting on #34 proper.
Consider this test:
[Test]
public void Cannot_proxy_generic_type_with_open_generic_type_parameter()
{
var innerType = typeof(IList<>);
var targetType = innerType.MakeGenericType(typeof(IList<>));
generator.CreateInterfaceProxyWithoutTarget(targetType, new IInterceptor[0]);
}
which corresponds to trying to proxy an IList<IList<>>.
It fails with
Test 'Castle.DynamicProxy.Tests.BasicInterfaceProxyTestCase.Cannot_proxy_generic_type_with_open_generic_type_parameter' failed:
System.ArgumentException : Cannot build type parameter for custom attribute with a type that does not support the AssemblyQualifiedName property. The type instance supplied was of type 'System.RuntimeType'.
Compare this to the attempt to make proxy an IList<>, which returns an ArgumentException with the message
You can't specify a generic type definition.
Parameter name: interfaceToProxy
This is not a big deal for FakeItEasy, I don't think, and probably less of a problem overall than #34, but if there's interest, I can look into it alongside or after the fix for #34.