From 173557b0096d6c2b60eb4d4aebed30666b3d91b1 Mon Sep 17 00:00:00 2001 From: Peter Kottas Date: Sat, 2 Jun 2018 12:53:40 +0200 Subject: [PATCH] Fixed problem with onStop service being null --- Source/PeterKottas.DotNetCore.WindowsService/ServiceRunner.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/PeterKottas.DotNetCore.WindowsService/ServiceRunner.cs b/Source/PeterKottas.DotNetCore.WindowsService/ServiceRunner.cs index c29ee9d..5f3d07f 100644 --- a/Source/PeterKottas.DotNetCore.WindowsService/ServiceRunner.cs +++ b/Source/PeterKottas.DotNetCore.WindowsService/ServiceRunner.cs @@ -198,6 +198,10 @@ public static int Run(Action> runAction) // Return the console host run result, so we get some idea what failed if result is not OK return (int)consoleHost.Run(); } + else + { + innerConfig.Service = innerConfig.ServiceFactory(innerConfig.ExtraArguments, null); + } ConfigureService(innerConfig);