Skip to content

Commit

Permalink
fix(templates): resolve app insights issue with empty connection string
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi authored Apr 20, 2024
1 parent d9c8361 commit 67ea3e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 67ea3e5

Please sign in to comment.