Service fabric uses these extension methods to remove non-service type interfaces
internal static class ServiceTypeExtensions { public static Type[] GetServiceInterfaces(this Type serviceType) { List<Type> typeList = new List<Type>(((IEnumerable<Type>)serviceType.GetInterfaces()).Where(t => typeof(IService).IsAssignableFrom(t))); typeList.RemoveAll(t => t.GetNonServiceParentType() != null); return typeList.ToArray(); } internal static Type GetNonServiceParentType(this Type type) { List<Type> typeList = new List<Type>(type.GetInterfaces()); if (typeList.RemoveAll(t => t == typeof(IService)) == 0) return type; foreach (Type type1 in typeList) { Type serviceParentType = type1.GetNonServiceParentType(); if (serviceParentType != null) return serviceParentType; } return null; } }
and checks the result
if (serviceInterfaces.Length == 0 && !serviceType.IsAbstract) throws the exception in question
So I found a workaround for this case
public interface IServiceWrapper : IService { } public interface INinjaService : IServiceWrapper, IFooService<SuperNinja> { }
UPDATED
After some investigation, I found that the proxy checks that all interface parents must be IService, which means
Type serviceParentType = serviceInterfaceType.GetNonServiceParentType(); if (serviceParentType != null) throws another exception
So, you need to make IFooService<T> obtained from IService , which is not supported at the moment.
So generics are not supported :(
source share