mirror of
https://github.com/babalae/better-genshin-impact
synced 2025-01-09 04:19:47 +08:00
33 lines
589 B
C#
33 lines
589 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BetterGenshinImpact.Helpers.Extensions;
|
|
|
|
internal static class TaskExtension
|
|
{
|
|
public static async void SafeForget(this Task task)
|
|
{
|
|
try
|
|
{
|
|
await task.ConfigureAwait(false);
|
|
}
|
|
catch (OperationCanceledException)
|
|
{
|
|
|
|
}
|
|
#if DEBUG
|
|
catch (Exception)
|
|
{
|
|
if (System.Diagnostics.Debugger.IsAttached)
|
|
{
|
|
System.Diagnostics.Debugger.Break();
|
|
}
|
|
}
|
|
#else
|
|
catch
|
|
{
|
|
}
|
|
#endif
|
|
}
|
|
}
|