Skip to content

Commit 3bce613

Browse files
Copilotdavidfowl
andcommitted
Address code review feedback
- Fix null handling in middleware path checks using safe navigation operator - Improve fallback error message to be more descriptive - Fix extra period in XML documentation comment - Clarify exit code logic - return -1 if validation failures exist regardless of dismissal Co-authored-by: davidfowl <[email protected]>
1 parent cc65305 commit 3bce613

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/Aspire.Dashboard/DashboardWebApplication.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public DashboardWebApplication(
174174
bool hasValidationFailures = !TryGetDashboardOptions(builder, dashboardConfigSection, out var dashboardOptions, out var failureMessages);
175175
if (hasValidationFailures)
176176
{
177-
_validationFailures = failureMessages?.ToList() ?? new List<string> { "Unknown validation error" };
177+
_validationFailures = failureMessages?.ToList() ?? new List<string> { "Failed to validate dashboard options. Check configuration and try again." };
178178
// Use default options to allow the app to build
179179
dashboardOptions = new DashboardOptions();
180180
// Set minimal required configuration
@@ -490,9 +490,9 @@ public DashboardWebApplication(
490490
!context.Request.Path.StartsWithSegments("/_content", StringComparison.OrdinalIgnoreCase) &&
491491
!context.Request.Path.StartsWithSegments("/css", StringComparison.OrdinalIgnoreCase) &&
492492
!context.Request.Path.StartsWithSegments("/js", StringComparison.OrdinalIgnoreCase) &&
493-
!context.Request.Path.Value!.EndsWith(".css", StringComparison.OrdinalIgnoreCase) &&
494-
!context.Request.Path.Value!.EndsWith(".js", StringComparison.OrdinalIgnoreCase) &&
495-
!context.Request.Path.Value!.EndsWith(".ico", StringComparison.OrdinalIgnoreCase))
493+
(context.Request.Path.Value?.EndsWith(".css", StringComparison.OrdinalIgnoreCase) != true) &&
494+
(context.Request.Path.Value?.EndsWith(".js", StringComparison.OrdinalIgnoreCase) != true) &&
495+
(context.Request.Path.Value?.EndsWith(".ico", StringComparison.OrdinalIgnoreCase) != true))
496496
{
497497
// Block OTLP and MCP endpoints when in error mode
498498
if (errorMode.ShouldBlock &&
@@ -986,7 +986,8 @@ public int Run()
986986
// Error mode middleware will redirect to the error page
987987
_app.Run();
988988

989-
// Return non-zero exit code if there were validation failures and user never dismissed them
989+
// Return non-zero exit code if there were validation failures
990+
// Even if the user dismissed them, the configuration is still invalid
990991
return _validationFailures.Count > 0 ? -1 : 0;
991992
}
992993

src/Aspire.Dashboard/Resources/Routes.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)