devoxin / SharpLink

Lavalink wrapper for Discord.Net written in C#
MIT License
27 stars 6 forks source link

Do not use GetAwaiter in logging methods #6

Closed FiniteReality closed 6 years ago

FiniteReality commented 6 years ago

Please, it's an absolutely horrible idea.

If you want to follow the "Discord.Net" approach, a good approach would be to make an async event helper class, akin to https://github.com/RogueException/Discord.Net/blob/dev/src/Discord.Net.Core/Utils/AsyncEvent.cs

This way you preserve ordering of event handlers, and invocations, as well as any exceptions which may occur in your event handlers - which would otherwise be uncaught and would leave tasks in faulted states without being able to be cleaned up

NovusTheory commented 6 years ago

Should be resolved along the lines of commit https://github.com/Devoxin/SharpLink/commit/0ca82fda0f0f8f6e00f7214afc8b5aa612809c7e