From 3b47616a9c57bd6ee0a7e43ca7a29279c40dd99c Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Tue, 2 May 2023 18:27:48 +0200 Subject: [PATCH] Use TryAddSingleton when registering default member store (#1983) --- .../ServiceCollectionExtensions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Proto.Cluster.AzureContainerApps/ServiceCollectionExtensions.cs b/src/Proto.Cluster.AzureContainerApps/ServiceCollectionExtensions.cs index e24dc01504..6e798c40f6 100644 --- a/src/Proto.Cluster.AzureContainerApps/ServiceCollectionExtensions.cs +++ b/src/Proto.Cluster.AzureContainerApps/ServiceCollectionExtensions.cs @@ -3,6 +3,7 @@ using Azure.ResourceManager; using JetBrains.Annotations; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Proto.Cluster.AzureContainerApps.Stores.ResourceTags; @@ -33,7 +34,7 @@ public static IServiceCollection AddAzureContainerAppsProvider(this IServiceColl services.AddSingleton(armClientProvider); // Register the default member store. - services.AddSingleton(sp => + services.TryAddSingleton(sp => { var clientProvider = sp.GetRequiredService(); var logger = sp.GetRequiredService>();