Base solution for your next web application
Open Closed

Castle Dependency Injection - cyclic dependencies & verbose logging #10971


User avatar
0
sedulen created

Prerequisites

  • What is your product version? v9.3.0
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .net core

If issue related with ABP Framework

  • What is ABP Framework version? v5.14.0

2 questions here really:

1.) within the Castle Dependency Injection, are there any toggle switches to control how cyclic dependencies are handled? I've seen cyclic dependencies identified and raised as exceptions previously, but in upgrading from ANZ v6.9.0 to v9.3.0, it looks like the behavior now is "different". It looks like I may have a cyclic dependency, but some DI resolution is still working? I really only see the cyclic dependency raised when looking at .dump files under a heavier load. But looking at the Parallel Tasks of the .dump file, the DI attempting to resolve cyclic dependencies is expensive and could really impact performance

2.) do you know if Castle has any verbose logging for when it resolves instances? In support of the cyclic dependencies I was troubleshooting, I would love to be able to use Microsoft.Extensions.Logging, and in the appsettings.json, under the Logging tag, set Castle to "Debug" logging. When I do that I don't see any change in the logging output.

Thanks! -Brian


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @sedulen

    1. I checked both our side and Castle side but coudln't find anything related.
    2. I also couldn't find any config for this.

    Is this cyclic dependencies property injected or constructor injected ? I think Castle doesn't throw exception for property injected dependencies.

  • User Avatar
    0
    sedulen created

    Hi @ismcagdas,

    I believe that this is a property injection. My AppNotifier class was inheriting from XYZDomainServiceBase instead of XYZServiceBase, so it was causing a cyclic dependency between IAppNotifier and TenantManager.

    A bummer that Castle doesn't provide any logging. It would be great to be able to see the total time spent in DI.

    in my performance issue I still occassionally see a substantial lag between Request Start (Middleware) and Action Start (ActionFilter). I can't figure out where that time is being lost to. But I'll keep digging in ky other thread.

    -Brian