Skip to content

fix: handle possible UnobservedTaskException#31

Merged
deleteLater merged 4 commits intomainfrom
fix/unobserved-task-exception
Mar 25, 2026
Merged

fix: handle possible UnobservedTaskException#31
deleteLater merged 4 commits intomainfrom
fix/unobserved-task-exception

Conversation

@deleteLater
Copy link
Copy Markdown
Contributor

fixed #30

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent TaskScheduler.UnobservedTaskException noise/crashes by ensuring certain fire-and-forget tasks (notably WebSocket connection and keep-alive paths) have their exceptions observed/handled.

Changes:

  • Added a TaskExtensions.Forget() helper to safely observe exceptions from fire-and-forget tasks.
  • Updated WebSocketDataSynchronizer.StartAsync() to observe the background ConnectAsync() task.
  • Wrapped FbWebSocket keep-alive ping send in a try/catch to avoid an unobserved exception when the connection is closed.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/FeatBit.ServerSdk/Utils/TaskExtensions.cs Introduces TaskExtensions.Forget() for observing exceptions from fire-and-forget tasks.
src/FeatBit.ServerSdk/Transport/FbWebSocket.cs Adds exception handling around keep-alive ping sending.
src/FeatBit.ServerSdk/DataSynchronizer/WebSocketDataSynchronizer.cs Uses Forget() to observe the background connect task kicked off during start.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

deleteLater and others added 2 commits March 25, 2026 17:26
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@deleteLater deleteLater merged commit e30c6eb into main Mar 25, 2026
1 check passed
@deleteLater deleteLater deleted the fix/unobserved-task-exception branch March 25, 2026 10:01
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.

SocketException / UnobservedTaskException

2 participants