Open Closed

An exception was thrown while activating. #1772


User avatar
0
sunivycsm created
  • ABP Framework version: v4.4.0
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • An exception was thrown while activating xxxController -> xxxAppService. Autofac.Core.DependencyResolutionException: An exception was thrown while activating xxxController -> xxxAppService.
  • Steps to reproduce the issue: When I access the list I get an exception, after checking the logs I found the exception I am getting as above. I put debug in the Controller file and made sure it ran in there, but it didn't run to my AppService.

7 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    When I access the list I get an exception

    Whitch website? and whitch page?

    Can you share the full error logs?

  • User Avatar
    0
    sunivycsm created

    ** It is a new module that I created, this is full log:

    An exception was thrown while activating CSM.Report.Top5WorkCodeAHTs.Top5WorkCodeAHTsController -> CSM.Report.Top5WorkCodeAHTs.Top5WorkCodeAHTAppService.
    Autofac.Core.DependencyResolutionException: An exception was thrown while activating CSM.Report.Top5WorkCodeAHTs.Top5WorkCodeAHTsController -> CSM.Report.Top5WorkCodeAHTs.Top5WorkCodeAHTAppService.
     ---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Volo.Abp.Autofac.AbpAutofacConstructorFinder' on type 'CSM.Report.Top5WorkCodeAHTs.Top5WorkCodeAHTAppService' can be invoked with the available services and parameters:
    Cannot resolve parameter 'CSM.Report.Top5WorkCodeAHTs.ITop5WorkCodeAHTRepository top5WorkCodeAHTRepository' of constructor 'Void .ctor(CSM.Report.Top5WorkCodeAHTs.ITop5WorkCodeAHTRepository, Volo.Abp.Domain.Repositories.IRepository`1[CSM.Inbound.WorkcodeLevel2s.WorkcodeLevel2], Volo.Abp.Domain.Repositories.IRepository`1[CSM.Inbound.WorkcodeLevel1s.WorkcodeLevel1], Volo.Abp.Domain.Repositories.IRepository`1[CSM.Inbound.WorkcodeCategories.WorkcodeCategory])'.
       at Autofac.Core.Activators.Reflection.ReflectionActivator.GetAllBindings(ConstructorBinder[] availableConstructors, IComponentContext context, IEnumerable`1 parameters)
       at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
       at Autofac.Core.Activators.Reflection.ReflectionActivator.<ConfigurePipeline>b__11_0(ResolveRequestContext ctxt, Action`1 next)
       at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
       at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
       at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.&lt;&gt;c__DisplayClass14_0.&lt;BuildPipeline&gt;b__1(ResolveRequestContext ctxt)
       at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClass41_0.<PropertiesAutowired>b__0(ResolveRequestContext ctxt, Action`1 next)
       at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.&lt;&gt;c__DisplayClass14_0.&lt;BuildPipeline&gt;b__1(ResolveRequestContext ctxt)
       at Autofac.Extras.DynamicProxy.RegistrationExtensions.&lt;&gt;c__DisplayClass8_0`3.<EnableInterfaceInterceptors>b__1(ResolveRequestContext ctxt, Action`1 next)
       at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.&lt;&gt;c__DisplayClass14_0.&lt;BuildPipeline&gt;b__1(ResolveRequestContext ctxt)
       at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
       --- End of inner exception stack trace ---
       at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
       at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.&lt;&gt;c__DisplayClass14_0.&lt;BuildPipeline&gt;b__1(ResolveRequestContext ctxt)
       at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.&lt;&gt;c__DisplayClass14_0.&lt;BuildPipeline&gt;b__1(ResolveRequestContext ctxt)
       at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
       at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
       at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
       at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action`1 next)
       at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.&lt;&gt;c__DisplayClass14_0.&lt;BuildPipeline&gt;b__1(ResolveRequestContext ctxt)
       at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
       at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request)
       at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
       at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
       at Microsoft.AspNetCore.Mvc.Controllers.ServiceBasedControllerActivator.Create(ControllerContext actionContext)
       at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.&lt;&gt;c__DisplayClass5_0.&lt;CreateControllerFactory&gt;g__CreateController|0(ControllerContext controllerContext)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
    --- End of stack trace from previous location ---
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeNextExceptionFilterAsync&gt;g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
    
  • User Avatar
    1
    sunivycsm created

    My controller:

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Cannot resolve parameter 'CSM.Report.Top5WorkCodeAHTs.ITop5WorkCodeAHTRepository top5WorkCodeAHTRepository'

    Can you share the code of Top5WorkCodeAHTAppService and Top5WorkCodeAHTRepository?

    You can also check the dependencies of your modules

  • User Avatar
    0
    sunivycsm created

    I have commented out the source code in the AppService section which just returns null. And I have dependencies on the main module.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    I have commented out the source code in the AppService section which just returns null.

    The error is in the constructor of Top5WorkCodeAHTAppService not methods.

  • User Avatar
    0
    sunivycsm created

    Thank you very much, I commented the code in the constructor and it ran into my AppService.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09