From c38825ba2a793dc7ea238fddec2afb9ed1787aa1 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Thu, 3 Feb 2022 23:05:28 +1100 Subject: [PATCH] Fix for .NET FX --- src/ImageSharp/Diagnostics/MemoryDiagnostics.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ImageSharp/Diagnostics/MemoryDiagnostics.cs b/src/ImageSharp/Diagnostics/MemoryDiagnostics.cs index 7ea484175..d83e737f1 100644 --- a/src/ImageSharp/Diagnostics/MemoryDiagnostics.cs +++ b/src/ImageSharp/Diagnostics/MemoryDiagnostics.cs @@ -1,7 +1,6 @@ -// Copyright (c) Six Labors. +// Copyright (c) Six Labors. // Licensed under the Apache License, Version 2.0. -using System; using System.Threading; namespace SixLabors.ImageSharp.Diagnostics @@ -69,10 +68,16 @@ namespace SixLabors.ImageSharp.Diagnostics } // Schedule on the ThreadPool, to avoid user callback messing up the finalizer thread. +#if NETSTANDARD2_1 || NETCOREAPP2_1_OR_GREATER ThreadPool.QueueUserWorkItem( stackTrace => undisposedAllocation?.Invoke(stackTrace), allocationStackTrace, preferLocal: false); +#else + ThreadPool.QueueUserWorkItem( + stackTrace => undisposedAllocation?.Invoke((string)stackTrace), + allocationStackTrace); +#endif } } }