Skip to content

[EC-234] [BEEEP] Improved BroadcastService and added exception handling on async void callbacks#1917

Merged
fedemkr merged 2 commits intomasterfrom
TDL-14-improve-broadcastservice
Jul 5, 2022
Merged

[EC-234] [BEEEP] Improved BroadcastService and added exception handling on async void callbacks#1917
fedemkr merged 2 commits intomasterfrom
TDL-14-improve-broadcastservice

Conversation

@fedemkr
Copy link
Member

@fedemkr fedemkr commented May 20, 2022

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

Improve BroadcastService on exception handling and also add try...catch on async void callbacks of the BroadcastService.

Code changes

  • BroadcastService.cs: Splitted Send(Message message, string id) because currently the id is not being sent by any method so we're doing some checks inside that never apply. Thus it made sense to split it so that we avoid this little overhead (and also the other method will be stripped out by the linker unless we call it from somewhere). In addition, exception handling was added to the call of the message action because it was being swallowed by the task thus we were not getting any reports to AppCenter if something failed.
  • Every other place: Changed unused async Action callback to be plain Action callback and in the places where async was needed, try...catch was added to handle the exception, because if not on an async void the exception doesn't bubble up to the caller task and just crashes the app.

###Notes:
BroadcastService and the IMessagingService needs further refactoring to improve the code and the dev experience but I'll do it on a different PR.

Before you submit

  • I have added unit tests where it makes sense to do so (encouraged but not required)
  • This change requires a documentation update (notify the documentation team)
  • This change has particular deployment requirements (notify the DevOps team)

@fedemkr fedemkr marked this pull request as ready for review May 20, 2022 23:11
@fedemkr fedemkr requested a review from a team May 20, 2022 23:11
@fedemkr fedemkr changed the title TDL-14 BEEEP Improved BroadcastService and added try...catch on async void callbacks TDL-14 BEEEP Improved BroadcastService and added exception handling on async void callbacks May 20, 2022
@fedemkr fedemkr changed the title TDL-14 BEEEP Improved BroadcastService and added exception handling on async void callbacks [TDL-14] [BEEEP] Improved BroadcastService and added exception handling on async void callbacks May 20, 2022
@fedemkr fedemkr changed the title [TDL-14] [BEEEP] Improved BroadcastService and added exception handling on async void callbacks [EC-234] [BEEEP] Improved BroadcastService and added exception handling on async void callbacks May 23, 2022
@fedemkr fedemkr requested a review from a team July 5, 2022 16:53
@fedemkr fedemkr merged commit 448cce3 into master Jul 5, 2022
@fedemkr fedemkr deleted the TDL-14-improve-broadcastservice branch July 5, 2022 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants