79703868

Date: 2025-07-16 18:34:28
Score: 3
Natty:
Report link

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;
}
Reasons:
  • RegEx Blacklisted phrase (2.5): do you have a
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Starts with a question (0.5): What do the
  • Low reputation (1):
Posted by: Eb3yr