aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2023-11-14 22:01:10 +0100
committerBond_009 <bond.009@outlook.com>2023-11-14 22:01:10 +0100
commit8ee15258944deb83b880cb5263fae2843a7af248 (patch)
tree2c6330518a29faf72b5f1722c1194563d3702f96
parent635d67d458e02df53a1b08998ccd3cff16e76ac3 (diff)
Fix runtime errors
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs4
-rw-r--r--src/Jellyfin.Extensions/Json/JsonDefaults.cs4
2 files changed, 6 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 9affe235d..4540ab205 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -310,7 +310,9 @@ namespace Emby.Server.Implementations
{
_creatingInstances.Add(type);
Logger.LogDebug("Creating instance of {Type}", type);
- return ActivatorUtilities.CreateInstance(ServiceProvider, type);
+ return ServiceProvider is null
+ ? Activator.CreateInstance(type)
+ : ActivatorUtilities.CreateInstance(ServiceProvider, type);
}
catch (Exception ex)
{
diff --git a/src/Jellyfin.Extensions/Json/JsonDefaults.cs b/src/Jellyfin.Extensions/Json/JsonDefaults.cs
index 4d56ca615..9e6d4c3f8 100644
--- a/src/Jellyfin.Extensions/Json/JsonDefaults.cs
+++ b/src/Jellyfin.Extensions/Json/JsonDefaults.cs
@@ -1,5 +1,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;
+using System.Text.Json.Serialization.Metadata;
using Jellyfin.Extensions.Json.Converters;
namespace Jellyfin.Extensions.Json
@@ -41,7 +42,8 @@ namespace Jellyfin.Extensions.Json
new JsonNullableStructConverterFactory(),
new JsonDateTimeConverter(),
new JsonStringConverter()
- }
+ },
+ TypeInfoResolver = new DefaultJsonTypeInfoResolver()
};
private static readonly JsonSerializerOptions _pascalCaseJsonSerializerOptions = new(_jsonSerializerOptions)