mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-16 12:57:44 +01:00
Make ServiceScope IAsyncDisposable
ServiceScope.Dispose was not waiting for scoped services to complete disposing. This had an effect of letting a new plugin instance register a DtrBar entry before previous plugin instance's entry got unregistered. This change also cleans up unloading procedure in LocalPlugin.
This commit is contained in:
parent
fdfdee1fcb
commit
0a8f9b73fb
7 changed files with 375 additions and 184 deletions
|
|
@ -63,6 +63,21 @@ public static class TaskExtensions
|
|||
#pragma warning restore RS0030
|
||||
}
|
||||
|
||||
/// <summary>Ignores any exceptions thrown from the task.</summary>
|
||||
/// <param name="task">Task to ignore exceptions.</param>
|
||||
/// <returns>A task that completes when <paramref name="task"/> completes in any state.</returns>
|
||||
public static async Task SuppressException(this Task task)
|
||||
{
|
||||
try
|
||||
{
|
||||
await task;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsWaitingValid(Task task)
|
||||
{
|
||||
// In the case the task has been started with the LongRunning flag, it will not be in the TPL thread pool and we can allow waiting regardless.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue