From a95ebf31d4ccd2f418f3a924ba9366dc36736740 Mon Sep 17 00:00:00 2001 From: Simon Shanks Date: Wed, 16 Sep 2026 17:37:35 +0100 Subject: [PATCH] fix warning SYSLIB0051 /src/kx/KException.cs(47,13): warning SYSLIB0051: 'Exception.Exception(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051) [/src/kx/kx.csproj::TargetFramework=net8.0] --- kx/KException.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kx/KException.cs b/kx/KException.cs index 02ad1e7..91eefaf 100644 --- a/kx/KException.cs +++ b/kx/KException.cs @@ -1,12 +1,16 @@ using System; +#if !NET8_0_OR_GREATER using System.Runtime.Serialization; +#endif namespace kx { /// /// An exception that is thrown when in an error occurs in the class. /// +#if !NET8_0_OR_GREATER [Serializable] +#endif public class KException : Exception { /// @@ -37,7 +41,7 @@ public KException(string message, Exception innerException) : base(message, innerException) { } - +#if !NET8_0_OR_GREATER /// /// Initialises a new instance of with serialised data. /// @@ -47,5 +51,6 @@ protected KException(SerializationInfo info, StreamingContext context) : base(info, context) { } +#endif } }