Frosty Frisby
Frosty Frisby

Reputation: 81

ASP.NET Boilerplate Service 'Microsoft.Extensions.DependencyInjection.IServiceProviderIsService' not registered

I just updated my visual studio so I could create a new project in .net 8, but now I'm getting the following error in my existing boilerplate 8.1.0 project:

'Microsoft.AspNetCore.Mvc.ApiExplorer.IApiDescriptionProvider_26c5b40a-354d-4734-90cd-1b6d59e8e3d1' is waiting for the following dependencies:

No changes were made to the project and it ran with no issue prior to updating visual studio

  1. Delete .vs folder
  2. Clean and rebuild solution

Upvotes: 8

Views: 2009

Answers (4)

RikRak
RikRak

Reputation: 963

I had a similar issue after upgrading to Visual Studio 17.11.1, in a codebase that used Unity IoC. In my case I added the following class and registered it with the Unity container with a ContainerControlledLifetime:

public class UnityServiceProviderIsService : IServiceProviderIsService
{
    private readonly IUnityContainer _container;

    public UnityServiceProviderIsService(IUnityContainer container)
    {
        _container = container;
    }

    public bool IsService(Type serviceType)
    {
        return _container.IsRegistered(serviceType);
    }
}

Ref: https://developercommunity.visualstudio.com/t/Upgrade-to-VS-v17111-breaks-swagger:-/10728128

Upvotes: 0

Gregory Pilipenko
Gregory Pilipenko

Reputation: 101

I have had the same problem and first I tried to apply advices I found here. But this didn't help in my case.

So I have applied another workaraound I found here: https://developercommunity.visualstudio.com/t/With-the-latest-upgrade-to-VS-2022-v179/10540911#T-N10585718

That is I have created own implementation of IServiceProviderIsService and placed it in Startup folder of my ASP.NET Boilerplate project (MyProject\src\MyProject.Web.Host\Startup):

using Abp.Dependency;
using Microsoft.Extensions.DependencyInjection;
using System;

namespace MyProject.Web.Host.Startup
{
    public class AutofacServiceProviderIsService : IServiceProviderIsService, ISingletonDependency
    {
        private readonly IIocManager iocManager;

        public AutofacServiceProviderIsService(IIocManager iocManager)
        {
            this.iocManager = iocManager;
        }
        public bool IsService(Type serviceType)
        {
            return iocManager.IsRegistered(serviceType);
        }
    }
}

This fixed my issue without necessaryti to downgrade Visual Studio or upgrade version of ASP.NET Boilerplate packages.

Upvotes: 10

SKaramese
SKaramese

Reputation: 34

The problem is solved when I update the ABP Version to 8.3 Example

Upvotes: 1

Manfu
Manfu

Reputation: 11

I found myself in the same situation as you and the only solution I found was to rollback the VS version from 17.9.0 to 17.8.6 (https://devblogs.microsoft.com/visualstudio/introducing-visual-studio-rollback/)

Upvotes: 0

Related Questions