From df46a4449043a0c6632a5a89fe85f046389d255b Mon Sep 17 00:00:00 2001 From: Nicholas Hayes <0xC0000054@users.noreply.github.com> Date: Fri, 8 May 2020 05:32:09 -0600 Subject: [PATCH] Replace Delegate.BeginInvoke with Task.Run Delegate.BeginInvoke was removed in .NET Core. See https://github.com/dotnet/runtime/issues/16312. --- src/GmicRunner.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/GmicRunner.cs b/src/GmicRunner.cs index 19fe4df..011b824 100644 --- a/src/GmicRunner.cs +++ b/src/GmicRunner.cs @@ -13,6 +13,7 @@ using System; using System.ComponentModel; using System.Threading; +using System.Threading.Tasks; namespace GmicSharp { @@ -22,18 +23,14 @@ internal sealed class GmicRunner #pragma warning disable IDE0032 // Use auto property private bool isRunning; #pragma warning restore IDE0032 // Use auto property - private readonly GmicWorkerDelegate workerDelegate; private readonly SendOrPostCallback workerCompleted; private float progress; private byte shouldAbort; - private delegate void GmicWorkerDelegate(GmicWorkerArgs args); - public GmicRunner() { asyncOperation = null; - workerDelegate = new GmicWorkerDelegate(GmicWorker); workerCompleted = new SendOrPostCallback(GmicWorkerCompleted); } @@ -78,7 +75,7 @@ public void Start(string command, imageList, token, hasProgressEvent); - workerDelegate.BeginInvoke(args, null, null); + Task.Run(() => GmicWorker(args), token); } private unsafe void GmicWorker(GmicWorkerArgs args)