diff --git a/src/Connected.Host/ConnectedPlatformService.cs b/src/Connected.Host/ConnectedPlatformService.cs index 99a8a65..3c09412 100644 --- a/src/Connected.Host/ConnectedPlatformService.cs +++ b/src/Connected.Host/ConnectedPlatformService.cs @@ -1,4 +1,5 @@ -using System.Reflection; +using System.Diagnostics; +using System.Reflection; using Connected.Host.Configuration; using Microsoft.Extensions.Options; @@ -16,6 +17,10 @@ internal sealed class ConnectedPlatformService : BackgroundService protected override async Task ExecuteAsync(CancellationToken stoppingToken) { + if (GlobalConfig.GetValue("waitForDebugger")) + while (!Debugger.IsAttached) + await Task.Delay(500); + await DependencyLoader.LoadPackages(Config.MicroServices, Config.Repositories); if (Type.GetType(Config.Start) is not Type startupType) diff --git a/src/Connected.Host/Program.cs b/src/Connected.Host/Program.cs index 9e0994f..d214fdc 100644 --- a/src/Connected.Host/Program.cs +++ b/src/Connected.Host/Program.cs @@ -11,6 +11,8 @@ namespace Connected.Host .CreateDefaultBuilder(args) .ConfigureAppConfiguration((_, cfg) => { + cfg.AddCommandLine(args); + var appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var segments = new Uri(appPath).Segments; diff --git a/src/Connected.Host/sys.json b/src/Connected.Host/sys.json index bffb95e..876a99b 100644 --- a/src/Connected.Host/sys.json +++ b/src/Connected.Host/sys.json @@ -25,5 +25,6 @@ "version": "1.0.*-*" } ], - "start": "Connected.Instance.Start, Connected.Instance" + "start": "Connected.Instance.Start, Connected.Instance", + "waitForDebugger": true }