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
}
}