diff --git a/src/ApplicationInsights.Kubernetes/ApplicationInsights.Kubernetes.csproj b/src/ApplicationInsights.Kubernetes/ApplicationInsights.Kubernetes.csproj
index 98fe4ff..01436ab 100644
--- a/src/ApplicationInsights.Kubernetes/ApplicationInsights.Kubernetes.csproj
+++ b/src/ApplicationInsights.Kubernetes/ApplicationInsights.Kubernetes.csproj
@@ -24,8 +24,8 @@
-
-
+
+
diff --git a/src/ApplicationInsights.Kubernetes/Extensions/ApplicationInsightsExtensions.cs b/src/ApplicationInsights.Kubernetes/Extensions/ApplicationInsightsExtensions.cs
index 94ae6da..df3f070 100644
--- a/src/ApplicationInsights.Kubernetes/Extensions/ApplicationInsightsExtensions.cs
+++ b/src/ApplicationInsights.Kubernetes/Extensions/ApplicationInsightsExtensions.cs
@@ -65,7 +65,7 @@ public static void StartApplicationInsightsKubernetesEnricher(this IServiceProvi
///
/// The service collection.
private static bool KubernetesTelemetryInitializerExists(IServiceCollection serviceCollection)
- => serviceCollection.Any(t => t.ImplementationType == typeof(KubernetesTelemetryInitializer));
+ => serviceCollection.Any(t => !t.IsKeyedService && t.ImplementationType == typeof(KubernetesTelemetryInitializer));
///
/// Configure the KubernetesTelemetryInitializer and its dependencies.
diff --git a/src/ApplicationInsights.Kubernetes/K8sInfoBootstrap.cs b/src/ApplicationInsights.Kubernetes/K8sInfoBootstrap.cs
index 3a82c6d..ee80717 100644
--- a/src/ApplicationInsights.Kubernetes/K8sInfoBootstrap.cs
+++ b/src/ApplicationInsights.Kubernetes/K8sInfoBootstrap.cs
@@ -14,7 +14,7 @@ internal class K8sInfoBootstrap : IK8sInfoBootstrap
private readonly AppInsightsForKubernetesOptions _options;
- private readonly object _locker = new object();
+ private readonly object _locker = new();
private readonly IServiceScopeFactory _serviceScopeFactory;
private bool _hasExecuted = false;
private readonly ExponentialDelaySource _exponentialDelaySource;