What do the function signatures inside your interfaces look like, and what does WidgetAdmin
inherit? I wouldn't expect any problems because you're using the recurring generic pattern, which I have a feeling you might not be implementing correctly. You also shouldn't be calling base(page)
because there's no base class to call the constructor of; do you have a WidgetBase
class implementing IWidgetBase<T>
that you're inheriting from in both WidgetPage
and WidgetAdmin
that isn't shown in the example you gave?
I tried re-creating what you've described and this seems to work fine:
public interface IWidgetBase<TSelf> : ISearch<TSelf>, IStuff<TSelf> where TSelf : class
{
public abstract Task<TSelf> SearchAsync();
public abstract Task<TSelf> StuffAsync();
}
public interface IWidgetAdmin<TSelf> : IWidgetBase<TSelf>, IDeleteWidget where TSelf : class { }
public interface IPage { }
public interface ISearch<T> { }
public interface IStuff<T> { }
public interface IDeleteWidget { }
public class WidgetPage : IWidgetBase<WidgetPage>
{
public WidgetPage(IPage page) { }
public async Task<WidgetPage> SearchAsync() => this;
public async Task<WidgetPage> StuffAsync() => this;
}
public class WidgetAdmin : IWidgetAdmin<WidgetAdmin>
{
public WidgetAdmin(IPage page) { }
public async Task<WidgetAdmin> SearchAsync() => this;
public async Task<WidgetAdmin> StuffAsync() => this;
}