When running a diagnostic on lifestyles for the container, potential misconfigurations are highlighted.
Following dependency chains have inconsistent accessibility:
- ITask (Singleton) -> Lazy1 (Transient)
- IStep1 (Singleton) -> Lazy1 (Transient)
- IStep1 (Singleton) -> Lazy1 (Transient)
- IStep1 (Singleton) -> Lazy1 (Transient)
Reproduce with the following code:
`public void EnsureMatchingLifestylesForKernel()
{
var host = (IDiagnosticsHost) _kernel.GetSubSystem(SubSystemConstants.DiagnosticsKey);
IHandler[][] misconfigurations = host.GetDiagnostic().Inspect();
if (misconfigurations.Any())
{
var diagnosticOutput = new StringBuilder();
diagnosticOutput.AppendLine("Following dependency chains have inconsistent accessibility:" + Environment.NewLine);
foreach (IHandler[] misconfiguration in misconfigurations)
{
diagnosticOutput.AppendLine(
string.Join(
" -> ",
misconfiguration
.Where(m => m.ComponentModel.Services.Any())
.Select(m => $"{m.ComponentModel.Services.First().Name} ({m.ComponentModel.LifestyleType})")));
}
//TODO: This should be an exception
_logger.LogWarning(Target.Service, diagnosticOutput.ToString());
}
`
When running a diagnostic on lifestyles for the container, potential misconfigurations are highlighted.
Following dependency chains have inconsistent accessibility:
Reproduce with the following code:
`public void EnsureMatchingLifestylesForKernel()
{
var host = (IDiagnosticsHost) _kernel.GetSubSystem(SubSystemConstants.DiagnosticsKey);
IHandler[][] misconfigurations = host.GetDiagnostic().Inspect();