Open Closed

DI based exception when running httpapi.host #9570


User avatar
0
sulay created

at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.IsConventionalRegistrationDisabled(Type type) at Volo.Abp.DependencyInjection.DefaultConventionalRegistrar.AddType(IServiceCollection services, Type type) at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.AddTypes(IServiceCollection services, Type[] types) at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.AddAssembly(IServiceCollection services, Assembly assembly) at Microsoft.Extensions.DependencyInjection.ServiceCollectionConventionalRegistrationExtensions.AddAssembly(IServiceCollection services, Assembly assembly) at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync() at Volo.Abp.AbpApplicationFactory.CreateAsync[TStartupModule](IServiceCollection services, Action1 optionsAction) at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplicationAsync[TStartupModule](IServiceCollection services, Action1 optionsAction) at Microsoft.Extensions.DependencyInjection.WebApplicationBuilderExtensions.AddApplicationAsync[TStartupModule](WebApplicationBuilder builder, Action`1 optionsAction) at Foundation.Program.Main(String[] args) in /home/sulay/Documents/GitHub/Foundation/src/Foundation.HttpApi.Host/Program.cs:line 36

  • Steps to reproduce the issue:

6 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • The exception trace you provided indicates an issue during ABP's conventional dependency injection registration, specifically in the IsConventionalRegistrationDisabled(Type type) method. This usually happens if there is a type in your project that cannot be registered conventionally, or if there is a misconfiguration in your module or dependency injection setup.

    To resolve this:

    1. Check for Abstract or Generic Types:
      Ensure you do not have abstract classes, open generic types, or types that should not be registered (such as base classes or marker interfaces) in your module assemblies. ABP tries to register all types it finds by convention, so any type that cannot be instantiated will cause this error.

    2. Disable Conventional Registration for Problematic Types:
      If you have a type that should not be registered, you can disable its conventional registration by using the [DisableConventionalRegistration] attribute:

      [DisableConventionalRegistration]
      public abstract class MyBaseService
      {
          // ...
      }
      

      Or, you can override the IsConventionalRegistrationDisabled method in your custom registrar if you have one.

    3. Check Your Module Dependencies:
      Make sure your module dependencies are correct and do not reference assemblies that are not meant to be scanned for DI registration.

    4. Review Recent Changes:
      If this error started after adding a new service, class, or module, review those changes for types that should not be registered.

    5. Clean and Rebuild:
      Sometimes, stale binaries can cause issues. Clean your solution and rebuild.

    6. Check for Duplicate or Conflicting Types:
      Ensure there are no duplicate types or conflicting class names across your assemblies.

    If you need to debug further, you can temporarily comment out or remove recently added classes or modules to isolate the problematic type.

    Sources:


    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share full logs?

    Thanks.

  • User Avatar
    0
    sulay created

    Hi,

    You mean the Debug console logs, correct ?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Hi

    There is a Logs\Logs.txt file under your project folder.

    You can share it with liming.ma@volosoft.com

    Thanks.

  • User Avatar
    0
    sulay created

    Hi,

    the logs content could just be pasted here, so here it is:

    2025-07-04 11:21:19.468 +00:00 [INF] Starting Foundation.HttpApi.Host. 2025-07-04 11:21:28.148 +00:00 [FTL] Host terminated unexpectedly! System.NullReferenceException: Object reference not set to an instance of an object. at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.IsConventionalRegistrationDisabled(Type type) at Volo.Abp.DependencyInjection.DefaultConventionalRegistrar.AddType(IServiceCollection services, Type type) at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.AddTypes(IServiceCollection services, Type[] types) at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.AddAssembly(IServiceCollection services, Assembly assembly) at Microsoft.Extensions.DependencyInjection.ServiceCollectionConventionalRegistrationExtensions.AddAssembly(IServiceCollection services, Assembly assembly) at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync() at Volo.Abp.AbpApplicationFactory.CreateAsync[TStartupModule](IServiceCollection services, Action1 optionsAction) at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplicationAsync[TStartupModule](IServiceCollection services, Action1 optionsAction) at Microsoft.Extensions.DependencyInjection.WebApplicationBuilderExtensions.AddApplicationAsync[TStartupModule](WebApplicationBuilder builder, Action`1 optionsAction) at Foundation.Program.Main(String[] args) in /home/sulay/Documents/GitHub/Foundation/src/Foundation.HttpApi.Host/Program.cs:line 36

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Could you share a project that reproduces this issue?

    liming.ma@volosoft.com

    Thanks

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on July 09, 2025, 06:20