fix: Create() => CreateAsync(), fix custom plugin IoC

This commit is contained in:
goaaats 2022-06-24 23:10:22 +02:00
parent fc6aa528c9
commit 5870c91bb4
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
3 changed files with 3 additions and 3 deletions

View file

@ -45,7 +45,7 @@ namespace Dalamud.IoC.Internal
/// <param name="objectType">The type of object to create.</param>
/// <param name="scopedObjects">Scoped objects to be included in the constructor.</param>
/// <returns>The created object.</returns>
public async Task<object?> Create(Type objectType, params object[] scopedObjects)
public async Task<object?> CreateAsync(Type objectType, params object[] scopedObjects)
{
var ctor = this.FindApplicableCtor(objectType, scopedObjects);
if (ctor == null)

View file

@ -361,7 +361,7 @@ namespace Dalamud.Plugin
realScopedObjects[0] = this;
Array.Copy(scopedObjects, 0, realScopedObjects, 1, scopedObjects.Length);
return svcContainer.Create(typeof(T), realScopedObjects) as T;
return (T)svcContainer.CreateAsync(typeof(T), realScopedObjects).GetAwaiter().GetResult();
}
/// <summary>

View file

@ -334,7 +334,7 @@ internal class LocalPlugin : IDisposable
this.DalamudInterface = new DalamudPluginInterface(this.pluginAssembly.GetName().Name!, this.DllFile, reason, this.IsDev);
var ioc = Service<ServiceContainer>.Get();
this.instance = ioc.Create(this.pluginType, this.DalamudInterface).GetAwaiter().GetResult() as IDalamudPlugin;
this.instance = ioc.CreateAsync(this.pluginType, this.DalamudInterface).GetAwaiter().GetResult() as IDalamudPlugin;
if (this.instance == null)
{
this.State = PluginState.LoadError;