private static void AdaptInterfaceServices(Type closedImplementationType, List<Type> closedServices, Type[] openServices, int index)
{
var genericDefinitionToInterface = default(IDictionary<Type, Type>);
while (index < openServices.Length)
{
var service = openServices[index];
if (service.IsGenericTypeDefinition)
{
EnsureInterfaceMappingInitialized(closedImplementationType, ref genericDefinitionToInterface);
Type closed;
if (genericDefinitionToInterface.TryGetValue(service, out closed))
{
closedServices.Add(closed);
}
#if !SILVERLIGHT
else
{
// NOTE: it's an interface not exposed by the implementation type. Possibly aimed at a proxy... I guess we can ignore it for now. Don't have any better idea.
Debug.Fail(string.Format("Could not find mapping for interface {0} on implementation type {1}", service, closedImplementationType));
}
#endif
}
else
{
closedServices.Add(service);
}
index++;
}
}