mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +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,
|
||||
Localization localization)
|
||||
{
|
||||
#if DEBUG
|
||||
lock (LoadedServices)
|
||||
void ProvideAllServices()
|
||||
{
|
||||
// ServiceContainer MUST be first. The static ctor of Service<T> will call Service<ServiceContainer>.Get()
|
||||
// which causes a deadlock otherwise.
|
||||
|
|
@ -150,6 +149,12 @@ internal static class ServiceManager
|
|||
ProvideService(localization);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
lock (LoadedServices)
|
||||
{
|
||||
ProvideAllServices()
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
void ProvideService<T>(T service) where T : IServiceType
|
||||
|
|
@ -159,12 +164,8 @@ internal static class ServiceManager
|
|||
LoadedServices.Add(typeof(T));
|
||||
}
|
||||
#else
|
||||
ProvideService(dalamud);
|
||||
ProvideService(fs);
|
||||
ProvideService(configuration);
|
||||
ProvideService(new ServiceContainer());
|
||||
ProvideService(scanner);
|
||||
ProvideService(localization);
|
||||
|
||||
ProvideAllServices();
|
||||
return;
|
||||
|
||||
void ProvideService<T>(T service) where T : IServiceType => Service<T>.Provide(service);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue