Repository: dotnet/efcore
File: src/EFCore.Design/Design/Internal/DesignTimeServicesBuilder.cs (C#)

Code before:
    /// <summary>
    ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
    ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
    ///     any release. You should only use it directly in your code with extreme caution and knowing that
    ///     doing so can result in application failures when updating to a new Entity Framework Core release.
    /// </summary>
    public virtual IServiceCollection CreateServiceCollection(string provider)
    {
        var services = new ServiceCollection();

        ConfigureReferencedServices(services, provider);
        ConfigureProviderServices(provider, services, throwOnError: true);
        services.AddEntityFrameworkDesignTimeServices(_reporter, GetApplicationServices);
        ConfigureUserServices(services);
        return services;
    }

    private IServiceProvider GetApplicationServices()
        => new AppServiceProviderFactory(_startupAssembly, _reporter).Create(_args);

    private void ConfigureUserServices(IServiceCollection services)
    {
        _reporter.WriteVerbose(DesignStrings.FindingDesignTimeServices(_startupAssembly.GetName().Name));

        var designTimeServicesType = _startupAssembly.GetLoadableDefinedTypes()
            .Where(t => typeof(IDesignTimeServices).IsAssignableFrom(t) && !t.IsAbstract).Select(t => t.AsType())
            .FirstOrDefault();
        if (designTimeServicesType == null)
        {
            _reporter.WriteVerbose(DesignStrings.NoDesignTimeServices);

            return;
        }

        _reporter.WriteVerbose(DesignStrings.UsingDesignTimeServices(designTimeServicesType.ShortDisplayName()));

        ConfigureDesignTimeServices(designTimeServicesType, services);
    }

    private void ConfigureReferencedServices(IServiceCollection services, string provider)
    {
        _reporter.WriteVerbose(DesignStrings.FindingReferencedServices(_startupAssembly.GetName().Name));
        _reporter.WriteVerbose(DesignStrings.FindingReferencedServices(_assembly.GetName().Name));

        var references = _startupAssembly.GetCustomAttributes<DesignTimeServicesReferenceAttribute>()
            .Concat(_assembly.GetCustomAttributes<DesignTimeServicesReferenceAttribute>())
            .Distinct()
            .ToList();

        if (references.Count == 0)
        {

Review comment (refactor):
@copilot Use `t.IsInstantiable()` instead of `!t.IsAbstract`

Code after:
    /// <summary>
    ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
    ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
    ///     any release. You should only use it directly in your code with extreme caution and knowing that
    ///     doing so can result in application failures when updating to a new Entity Framework Core release.
    /// </summary>
    public virtual IServiceCollection CreateServiceCollection(string provider)
    {
        var services = new ServiceCollection();

        ConfigureReferencedServices(services, provider);
        ConfigureProviderServices(provider, services, throwOnError: true);
        services.AddEntityFrameworkDesignTimeServices(_reporter, GetApplicationServices);
        ConfigureUserServices(services);
        return services;
    }

    private IServiceProvider GetApplicationServices()
        => new AppServiceProviderFactory(_startupAssembly, _reporter).Create(_args);

    private void ConfigureUserServices(IServiceCollection services)
    {
        _reporter.WriteVerbose(DesignStrings.FindingDesignTimeServices(_startupAssembly.GetName().Name));

        var designTimeServicesType = _startupAssembly.GetLoadableDefinedTypes()
            .Where(t => typeof(IDesignTimeServices).IsAssignableFrom(t) && t.IsInstantiable()).Select(t => t.AsType())
            .FirstOrDefault();
        if (designTimeServicesType == null)
        {
            _reporter.WriteVerbose(DesignStrings.NoDesignTimeServices);

            return;
        }

        _reporter.WriteVerbose(DesignStrings.UsingDesignTimeServices(designTimeServicesType.ShortDisplayName()));

        ConfigureDesignTimeServices(designTimeServicesType, services);
    }

    private void ConfigureReferencedServices(IServiceCollection services, string provider)
    {
        _reporter.WriteVerbose(DesignStrings.FindingReferencedServices(_startupAssembly.GetName().Name));
        _reporter.WriteVerbose(DesignStrings.FindingReferencedServices(_assembly.GetName().Name));

        var references = _startupAssembly.GetCustomAttributes<DesignTimeServicesReferenceAttribute>()
            .Concat(_assembly.GetCustomAttributes<DesignTimeServicesReferenceAttribute>())
            .Distinct()
            .ToList();

        if (references.Count == 0)
        {