mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Provide services in the same order in Debug and Release
This commit is contained in:
parent
22430ce054
commit
1913a4cd2c
1 changed files with 9 additions and 8 deletions
|
|
@ -136,8 +136,7 @@ internal static class ServiceManager
|
||||||
TargetSigScanner scanner,
|
TargetSigScanner scanner,
|
||||||
Localization localization)
|
Localization localization)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
void ProvideAllServices()
|
||||||
lock (LoadedServices)
|
|
||||||
{
|
{
|
||||||
// ServiceContainer MUST be first. The static ctor of Service<T> will call Service<ServiceContainer>.Get()
|
// ServiceContainer MUST be first. The static ctor of Service<T> will call Service<ServiceContainer>.Get()
|
||||||
// which causes a deadlock otherwise.
|
// which causes a deadlock otherwise.
|
||||||
|
|
@ -150,6 +149,12 @@ internal static class ServiceManager
|
||||||
ProvideService(localization);
|
ProvideService(localization);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
lock (LoadedServices)
|
||||||
|
{
|
||||||
|
ProvideAllServices()
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
void ProvideService<T>(T service) where T : IServiceType
|
void ProvideService<T>(T service) where T : IServiceType
|
||||||
|
|
@ -159,12 +164,8 @@ internal static class ServiceManager
|
||||||
LoadedServices.Add(typeof(T));
|
LoadedServices.Add(typeof(T));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ProvideService(dalamud);
|
|
||||||
ProvideService(fs);
|
ProvideAllServices();
|
||||||
ProvideService(configuration);
|
|
||||||
ProvideService(new ServiceContainer());
|
|
||||||
ProvideService(scanner);
|
|
||||||
ProvideService(localization);
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
void ProvideService<T>(T service) where T : IServiceType => Service<T>.Provide(service);
|
void ProvideService<T>(T service) where T : IServiceType => Service<T>.Provide(service);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue