aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Common/ManagedState.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/slskd/Common/ManagedState.cs')
-rw-r--r--src/slskd/Common/ManagedState.cs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/slskd/Common/ManagedState.cs b/src/slskd/Common/ManagedState.cs
index 0453aa06..bfde3c80 100644
--- a/src/slskd/Common/ManagedState.cs
+++ b/src/slskd/Common/ManagedState.cs
@@ -18,6 +18,7 @@
namespace slskd
{
using System;
+ using System.Text.Json;
using Microsoft.Extensions.DependencyInjection;
/// <summary>
@@ -57,7 +58,7 @@ namespace slskd
/// Provides point-in-time read access for state objects.
/// </summary>
/// <typeparam name="T">The type of the tracked state object.</typeparam>
- public interface IStateSnapshot<T>
+ public interface IStateSnapshot<out T>
{
/// <summary>
/// Gets the snapshotted state.
@@ -133,7 +134,7 @@ namespace slskd
/// <param name="value">The current value of the state.</param>
public StateSnapshot(T value)
{
- Value = value.ToJson().ToObject<T>();
+ Value = JsonSerializer.Deserialize<T>(JsonSerializer.Serialize(value));
}
/// <summary>