diff --git a/Demos/FeedDemo/FeedDemo.csproj b/Demos/FeedDemo/FeedDemo.csproj index c9f7094..691f166 100644 --- a/Demos/FeedDemo/FeedDemo.csproj +++ b/Demos/FeedDemo/FeedDemo.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net8.0 diff --git a/Demos/QueryResponseDemo/QueryResponseDemo.csproj b/Demos/QueryResponseDemo/QueryResponseDemo.csproj index c1388b1..158e112 100644 --- a/Demos/QueryResponseDemo/QueryResponseDemo.csproj +++ b/Demos/QueryResponseDemo/QueryResponseDemo.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net8.0 diff --git a/Demos/SerializationDemo/SerializationDemo.csproj b/Demos/SerializationDemo/SerializationDemo.csproj index c1388b1..158e112 100644 --- a/Demos/SerializationDemo/SerializationDemo.csproj +++ b/Demos/SerializationDemo/SerializationDemo.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net8.0 diff --git a/Demos/SubscriberDemo/SubscriberDemo.csproj b/Demos/SubscriberDemo/SubscriberDemo.csproj index c1388b1..158e112 100644 --- a/Demos/SubscriberDemo/SubscriberDemo.csproj +++ b/Demos/SubscriberDemo/SubscriberDemo.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net8.0 diff --git a/kx.Benchmark.Test/kx.Benchmark.Test.csproj b/kx.Benchmark.Test/kx.Benchmark.Test.csproj index 8a8c45d..d7ae79c 100644 --- a/kx.Benchmark.Test/kx.Benchmark.Test.csproj +++ b/kx.Benchmark.Test/kx.Benchmark.Test.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net8 kx.Benchmark.Test.Program true kx.Benchmark.Test.snk diff --git a/kx.Test/TestUtils/TestSerialisationHelper.cs b/kx.Test/TestUtils/TestSerialisationHelper.cs index 0d3f039..b8708ed 100644 --- a/kx.Test/TestUtils/TestSerialisationHelper.cs +++ b/kx.Test/TestUtils/TestSerialisationHelper.cs @@ -1,42 +1,42 @@ -using System; +using MessagePack; +using System; using System.IO; using System.Runtime.Serialization.Formatters.Binary; +using System.Text.Json; namespace kx.Test.TestUtils { + /// + /// A helper class for testing serialisation and de-serialisation logic + /// in unit-tests + /// + internal static class TestSerialisationHelper + { /// - /// A helper class for testing serialisation and de-serialisation logic - /// in unit-tests + /// Performs binary serialisation and de-serialisation on a specified exception. /// - internal static class TestSerialisationHelper + /// The type of exception being tested. + /// The exception to be serialised and de-serialised. + /// + /// A de-serialised instance of the exception passed. All serialisable members should match the original. + /// + /// + /// This is primarily intended to confirm custom exceptions within the DeltaApiCore + /// library comply to ISerialization pattern. + /// + /// See https://stackoverflow.com/questions/94488/what-is-the-correct-way-to-make-a-custom-net-exception-serializable + /// + public static T SerialiseAndDeserialiseException(T exception) + where T : Exception { - /// - /// Performs binary serialisation and de-serialisation on a specified exception. - /// - /// The type of exception being tested. - /// The exception to be serialised and de-serialised. - /// - /// A de-serialised instance of the exception passed. All serialisable members should match the original. - /// - /// - /// This is primarily intended to confirm custom exceptions within the DeltaApiCore - /// library comply to ISerialization pattern. - /// - /// See https://stackoverflow.com/questions/94488/what-is-the-correct-way-to-make-a-custom-net-exception-serializable - /// - public static T SerialiseAndDeserialiseException(T exception) - where T : Exception - { - BinaryFormatter binaryFormatter = new BinaryFormatter(); + using (var stream = new MemoryStream()) + { + MessagePackSerializer.Serialize(stream, exception, MessagePack.Resolvers.ContractlessStandardResolver.Options); - using (var stream = new MemoryStream()) - { - binaryFormatter.Serialize(stream, exception); + stream.Seek(0, 0); - stream.Seek(0, 0); - - return (T)binaryFormatter.Deserialize(stream); - } - } + return (T)MessagePackSerializer.Deserialize(stream, MessagePack.Resolvers.ContractlessStandardResolver.Options); + } } + } } diff --git a/kx.Test/kx.Test.csproj b/kx.Test/kx.Test.csproj index b42f6ab..bb0f0ad 100644 --- a/kx.Test/kx.Test.csproj +++ b/kx.Test/kx.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net8 false @@ -25,6 +25,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/kx/kx.csproj b/kx/kx.csproj index 97ed3ab..e39bf11 100644 --- a/kx/kx.csproj +++ b/kx/kx.csproj @@ -1,7 +1,7 @@ - netstandard2.1 + net8.0 CSharpKDB CSharpKDB Provides functionality for .NET applications to interface with a KDB+ process.