mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-21 23:37:44 +01:00
fix: scoped services must register their dependencies with PluginManager to ensure the backing services are kept alive long enough
This commit is contained in:
parent
e9e234b340
commit
4b9de31240
3 changed files with 72 additions and 33 deletions
|
|
@ -53,7 +53,6 @@ internal class ServiceContainer : IServiceProvider, IServiceType
|
|||
}
|
||||
|
||||
this.instances[typeof(T)] = new(instance.ContinueWith(x => new WeakReference(x.Result)), typeof(T));
|
||||
this.RegisterInterfaces(typeof(T));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -69,7 +68,7 @@ internal class ServiceContainer : IServiceProvider, IServiceType
|
|||
foreach (var resolvableType in resolveViaTypes)
|
||||
{
|
||||
Log.Verbose("=> {InterfaceName} provides for {TName}", resolvableType.FullName ?? "???", type.FullName ?? "???");
|
||||
|
||||
|
||||
Debug.Assert(!this.interfaceToTypeMap.ContainsKey(resolvableType), "A service already implements this interface, this is not allowed");
|
||||
Debug.Assert(type.IsAssignableTo(resolvableType), "Service does not inherit from indicated ResolveVia type");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue