diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MauiProgram.Services.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MauiProgram.Services.cs index 1959357d84..e15115137e 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MauiProgram.Services.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MauiProgram.Services.cs @@ -51,7 +51,11 @@ public static void ConfigureServices(this MauiAppBuilder builder) builder.Logging.AddApplicationInsights(config => { config.TelemetryInitializers.Add(new MauiTelemetryInitializer()); - config.ConnectionString = configuration["ApplicationInsights:ConnectionString"]; + var connectionString = configuration["ApplicationInsights:ConnectionString"]; + if (string.IsNullOrEmpty(connectionString) is false) + { + config.ConnectionString = connectionString; + } }, options => { options.IncludeScopes = true; diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Program.Services.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Program.Services.cs index 19bccbf229..774a523843 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Program.Services.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Program.Services.cs @@ -51,7 +51,11 @@ public static void ConfigureServices(this IServiceCollection services) loggingBuilder.AddApplicationInsights(config => { config.TelemetryInitializers.Add(new WindowsTelemetryInitializer()); - config.ConnectionString = configuration["ApplicationInsights:ConnectionString"]; + var connectionString = configuration["ApplicationInsights:ConnectionString"]; + if (string.IsNullOrEmpty(connectionString) is false) + { + config.ConnectionString = connectionString; + } }, options => { options.IncludeScopes = true;