Skip to content

Gracefully handle connection error between dashboard and app host #10880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 7, 2025

When the dashboard cannot connect to the app host, RpcExceptions were bubbling up to Blazor's error boundary, displaying the technical yellow error bar instead of providing helpful user guidance.

This change adds graceful error handling to the ApplicationName component, which is one of the first components to establish connection with the app host. Now when connection fails:

Before:

  • RpcException bubbles up → Blazor error boundary → Yellow error bar with technical details
  • User sees confusing technical error message
  • No clear path to recovery

After:

  • RpcException caught → User-friendly dialog displayed
  • Clear message: "Unable to connect to the app host. Please ensure the app host is running and try again."
  • Retry button refreshes the dashboard for immediate recovery
  • Cancel button dismisses dialog gracefully

Implementation Details

New ConnectionErrorDialog Component

  • Created Components/Dialogs/ConnectionErrorDialog.razor using FluentUI components
  • Implements IDialogContentComponent<ConnectionErrorDialogResult> interface
  • Provides two actions: Retry (refreshes dashboard) and Cancel (dismisses dialog)

Enhanced ApplicationName Component Error Handling

try
{
    await DashboardClient.WhenConnected.WaitAsync(_disposalCts.Token);
}
catch (RpcException)
{
    // Show user-friendly dialog instead of letting exception bubble up
    await ShowConnectionErrorDialogAsync();
}
catch (Exception)
{
    // Handle other connection-related errors gracefully
    await ShowConnectionErrorDialogAsync();
}

Localized Error Messages

Added new resource strings in Dialogs.resx:

  • Connection error dialog title and message
  • Retry and cancel button labels
  • Properly integrated with existing localization system

Retry Mechanism

The retry button calls NavigationManager.NavigateTo("/", forceLoad: true) to completely refresh the dashboard, allowing all components to re-initialize and attempt connection again.

This provides a much better user experience when the app host is temporarily unavailable or takes time to start up, replacing technical error messages with clear guidance and recovery options.

Fixes #10879.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@Copilot Copilot AI changed the title [WIP] Gracefully handle connection error between dashboard and app host Gracefully handle connection error between dashboard and app host Aug 7, 2025
Copilot finished work on behalf of JamesNK August 7, 2025 23:58
@Copilot Copilot AI requested a review from JamesNK August 7, 2025 23:58
@JamesNK
Copy link
Member

JamesNK commented Aug 9, 2025

The dashboard failing to connect to the app host on startup is now the most common unhandled exception. This change handles it more cleanly.

Dialog displayed on startup when the dashboard can't connect:

image

@JamesNK JamesNK requested review from mitchdenny and adamint August 9, 2025 10:27
@davidfowl
Copy link
Member

Nice!

@JamesNK
Copy link
Member

JamesNK commented Aug 9, 2025

Hmm, the retry button won't actually do anything. Once the connect TCS is failed then that's it until the dashboard is restarted.

Need to have a method on the client to force it to reconnect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gracefully handle connection error between dashboard and app host
3 participants