- Fixed the "deadlock" (tasks not started).
This commit is contained in:
@@ -36,8 +36,8 @@ namespace Barotrauma
|
||||
_servicesProvider = SetupServicesProvider();
|
||||
if (!ValidateLuaCsContent())
|
||||
{
|
||||
Logger.LogError($"{nameof(LuaCsSetup)}: ModConfigXml missing. Unable to continue.");
|
||||
throw new ApplicationException($"{nameof(LuaCsSetup)}: Lua ModConfig.xml is missing. Unable to continue.");
|
||||
Logger.LogError($"{nameof(LuaCsSetup)}: ModConfig.xml missing. Unable to continue.");
|
||||
throw new ApplicationException($"{nameof(LuaCsSetup)}: Lua's ModConfig.xml is missing. Unable to continue.");
|
||||
}
|
||||
_runStateMachine = SetupStateMachine();
|
||||
SubscribeToLuaCsEvents();
|
||||
|
||||
@@ -151,12 +151,17 @@ public sealed class PackageManagementService : IPackageManagementService
|
||||
try
|
||||
{
|
||||
var res = new FluentResults.Result();
|
||||
var r = Task.WhenAll(
|
||||
new Task<Task<FluentResults.Result>>(async Task<FluentResults.Result> () => new FluentResults.Result()
|
||||
var configsTask = new Task<Task<FluentResults.Result>>(async Task<FluentResults.Result> () =>
|
||||
new FluentResults.Result()
|
||||
.WithReasons((await _configService.LoadConfigsAsync(config.Configs)).Reasons)
|
||||
.WithReasons((await _configService.LoadConfigsProfilesAsync(config.Configs)).Reasons)),
|
||||
new Task<Task<FluentResults.Result>>(async () => await _luaScriptManagementService.LoadScriptResourcesAsync(config.LuaScripts))
|
||||
).ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
.WithReasons((await _configService.LoadConfigsProfilesAsync(config.Configs)).Reasons));
|
||||
var luaScriptsTask = new Task<Task<FluentResults.Result>>(async () =>
|
||||
await _luaScriptManagementService.LoadScriptResourcesAsync(config.LuaScripts));
|
||||
|
||||
configsTask.Start();
|
||||
luaScriptsTask.Start();
|
||||
|
||||
var r = Task.WhenAll(configsTask, luaScriptsTask).ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
|
||||
foreach (var task in r)
|
||||
res.WithReasons(task.ConfigureAwait(false).GetAwaiter().GetResult().Reasons);
|
||||
|
||||
@@ -235,6 +235,7 @@ public sealed class ModConfigService : IModConfigService
|
||||
|
||||
private async Task<Result<IModConfigInfo>> CreateFromLegacyAsync(ContentPackage src)
|
||||
{
|
||||
// TODO: Implement legacy mod analysis
|
||||
return new ModConfigInfo()
|
||||
{
|
||||
Package = src,
|
||||
|
||||
Reference in New Issue
Block a user