fix: type confusion when assigning dep getter tasks

This commit is contained in:
goat 2023-03-09 20:38:59 +01:00
parent 5b10ecfc04
commit 53bfda3b33
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
2 changed files with 6 additions and 3 deletions

View file

@ -10,6 +10,7 @@ using Dalamud.Game;
using Dalamud.Game.Gui.Internal;
using Dalamud.Interface.Internal;
using Dalamud.Plugin.Internal;
using Dalamud.Utility;
using Serilog;
#if DEBUG
@ -81,6 +82,7 @@ internal sealed class Dalamud : IServiceType
catch (Exception e)
{
Log.Error(e, "Service initialization failure");
Util.Fatal("Dalamud could not initialize correctly. Please report this error. \n\nThe game will continue, but you may not be able to use plugins.", "Dalamud", false);
}
finally
{

View file

@ -138,8 +138,9 @@ internal static class ServiceManager
Debug.Assert(!serviceKind.HasFlag(ServiceKind.ManualService), "Regular services should never end up here");
var getTask = (Task)typeof(Service<>)
.MakeGenericType(serviceType)
var genericWrappedServiceType = typeof(Service<>).MakeGenericType(serviceType);
var getTask = (Task)genericWrappedServiceType
.InvokeMember(
"GetAsync",
BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.Public,
@ -149,7 +150,7 @@ internal static class ServiceManager
if (serviceKind.HasFlag(ServiceKind.BlockingEarlyLoadedService))
{
getAsyncTaskMap[typeof(Service<>).MakeGenericType(serviceType)] = getTask;
getAsyncTaskMap[serviceType] = getTask;
blockingEarlyLoadingServices.Add(serviceType);
}
else