diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index 0a60b703f..769cac713 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -154,30 +154,27 @@ namespace MediaBrowser.Common.Implementations /// Inits this instance. /// /// Task. - public virtual Task Init() + public virtual async Task Init() { - return Task.Run(() => - { - IsFirstRun = !ConfigurationManager.CommonConfiguration.IsStartupWizardCompleted; - - Logger = LogManager.GetLogger("App"); + IsFirstRun = !ConfigurationManager.CommonConfiguration.IsStartupWizardCompleted; - DiscoverTypes(); + Logger = LogManager.GetLogger("App"); - LogManager.ReloadLogger(ConfigurationManager.CommonConfiguration.EnableDebugLevelLogging ? LogSeverity.Debug : LogSeverity.Info); + DiscoverTypes(); - Logger.Info("Version {0} initializing", ApplicationVersion); + LogManager.ReloadLogger(ConfigurationManager.CommonConfiguration.EnableDebugLevelLogging ? LogSeverity.Debug : LogSeverity.Info); - Kernel = GetKernel(); + Logger.Info("Version {0} initializing", ApplicationVersion); - RegisterResources(); + Kernel = GetKernel(); - FindParts(); + await RegisterResources().ConfigureAwait(false); - Task.Run(() => ConfigureAutoRunAtStartup()); + FindParts(); - Kernel.Init(); - }); + Task.Run(() => ConfigureAutoRunAtStartup()); + + Kernel.Init(); } /// @@ -224,44 +221,47 @@ namespace MediaBrowser.Common.Implementations /// /// Registers resources that classes will depend on /// - protected virtual void RegisterResources() + protected virtual Task RegisterResources() { - RegisterSingleInstance(ConfigurationManager); - RegisterSingleInstance(this); + return Task.Run(() => + { + RegisterSingleInstance(ConfigurationManager); + RegisterSingleInstance(this); - RegisterSingleInstance(ApplicationPaths); + RegisterSingleInstance(ApplicationPaths); - var networkManager = new NetworkManager(); + var networkManager = new NetworkManager(); - var serverManager = new ServerManager.ServerManager(this, Kernel, networkManager, JsonSerializer, Logger, ConfigurationManager); + var serverManager = new ServerManager.ServerManager(this, Kernel, networkManager, JsonSerializer, Logger, ConfigurationManager); - TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, Logger, serverManager); + TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, Logger, serverManager); - RegisterSingleInstance(JsonSerializer); - RegisterSingleInstance(XmlSerializer); + RegisterSingleInstance(JsonSerializer); + RegisterSingleInstance(XmlSerializer); - RegisterSingleInstance(LogManager); - RegisterSingleInstance(Logger); + RegisterSingleInstance(LogManager); + RegisterSingleInstance(Logger); - RegisterSingleInstance(Kernel); + RegisterSingleInstance(Kernel); - RegisterSingleInstance(TaskManager); - RegisterSingleInstance(() => new AlchemyServer(Logger)); - RegisterSingleInstance(ProtobufSerializer); - RegisterSingleInstance(new UdpServer(Logger), false); + RegisterSingleInstance(TaskManager); + RegisterSingleInstance(() => new AlchemyServer(Logger)); + RegisterSingleInstance(ProtobufSerializer); + RegisterSingleInstance(new UdpServer(Logger), false); - var httpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, Logger); + var httpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, Logger); - RegisterSingleInstance(httpClient); + RegisterSingleInstance(httpClient); - RegisterSingleInstance(networkManager); - RegisterSingleInstance(serverManager); + RegisterSingleInstance(networkManager); + RegisterSingleInstance(serverManager); - SecurityManager = new PluginSecurityManager(Kernel, httpClient, JsonSerializer, ApplicationPaths); + SecurityManager = new PluginSecurityManager(Kernel, httpClient, JsonSerializer, ApplicationPaths); - RegisterSingleInstance(SecurityManager); + RegisterSingleInstance(SecurityManager); - RegisterSingleInstance(new PackageManager(SecurityManager, networkManager, httpClient, ApplicationPaths, JsonSerializer, Logger)); + RegisterSingleInstance(new PackageManager(SecurityManager, networkManager, httpClient, ApplicationPaths, JsonSerializer, Logger)); + }); } /// diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs index c36e0fa7f..80ed5bea7 100644 --- a/MediaBrowser.ServerApplication/ApplicationHost.cs +++ b/MediaBrowser.ServerApplication/ApplicationHost.cs @@ -95,9 +95,9 @@ namespace MediaBrowser.ServerApplication /// /// Registers resources that classes will depend on /// - protected override void RegisterResources() + protected override async Task RegisterResources() { - base.RegisterResources(); + await base.RegisterResources().ConfigureAwait(false); RegisterSingleInstance(ApplicationPaths); diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 3b350aaf2..f7253b72e 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.30 + 3.0.31 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index c8c4ab0e4..01b27a0cb 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.30 + 3.0.31 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index fbba2cea6..ffcd539f5 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.30 + 3.0.31 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - +