Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Demos/FeedDemo/FeedDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
2 changes: 1 addition & 1 deletion Demos/QueryResponseDemo/QueryResponseDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
2 changes: 1 addition & 1 deletion Demos/SerializationDemo/SerializationDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
2 changes: 1 addition & 1 deletion Demos/SubscriberDemo/SubscriberDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
2 changes: 1 addition & 1 deletion kx.Benchmark.Test/kx.Benchmark.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8</TargetFramework>
<StartupObject>kx.Benchmark.Test.Program</StartupObject>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>kx.Benchmark.Test.snk</AssemblyOriginatorKeyFile>
Expand Down
60 changes: 30 additions & 30 deletions kx.Test/TestUtils/TestSerialisationHelper.cs
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// A helper class for testing serialisation and de-serialisation logic
/// in unit-tests
/// </summary>
internal static class TestSerialisationHelper
{
/// <summary>
/// A helper class for testing serialisation and de-serialisation logic
/// in unit-tests
/// Performs binary serialisation and de-serialisation on a specified exception.
/// </summary>
internal static class TestSerialisationHelper
/// <typeparam name="T">The type of exception being tested.</typeparam>
/// <param name="exception">The exception to be serialised and de-serialised.</param>
/// <returns>
/// A de-serialised instance of the exception passed. All serialisable members should match the original.
/// </returns>
/// <remarks>
/// 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
/// </remarks>
public static T SerialiseAndDeserialiseException<T>(T exception)
where T : Exception
{
/// <summary>
/// Performs binary serialisation and de-serialisation on a specified exception.
/// </summary>
/// <typeparam name="T">The type of exception being tested.</typeparam>
/// <param name="exception">The exception to be serialised and de-serialised.</param>
/// <returns>
/// A de-serialised instance of the exception passed. All serialisable members should match the original.
/// </returns>
/// <remarks>
/// 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
/// </remarks>
public static T SerialiseAndDeserialiseException<T>(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<T>(stream, MessagePack.Resolvers.ContractlessStandardResolver.Options);
}
}
}
}
3 changes: 2 additions & 1 deletion kx.Test/kx.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8</TargetFramework>

<IsPackable>false</IsPackable>

Expand All @@ -25,6 +25,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MessagePack" Version="3.1.3" />
<PackageReference Include="Moq" Version="4.15.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
Expand Down
2 changes: 1 addition & 1 deletion kx/kx.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Title>CSharpKDB</Title>
<PackageId>CSharpKDB</PackageId>
<Description>Provides functionality for .NET applications to interface with a KDB+ process.</Description>
Expand Down