From 46775cb4f85d479f4e60b92f9a6064ccee22fd36 Mon Sep 17 00:00:00 2001 From: Randell L Hodges Date: Wed, 8 Jun 2022 09:38:37 -0500 Subject: [PATCH] Don't attempt to configure a job if the expression is null. Useful if you comment out the configuration in the appsettings.json file. --- src/EasyCronJob.AutoConfigurer/Startup.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/EasyCronJob.AutoConfigurer/Startup.cs b/src/EasyCronJob.AutoConfigurer/Startup.cs index 00aec12..fda0a29 100644 --- a/src/EasyCronJob.AutoConfigurer/Startup.cs +++ b/src/EasyCronJob.AutoConfigurer/Startup.cs @@ -142,6 +142,8 @@ public static IServiceCollection AutoConfigurer(this IServiceCollection services private static IServiceCollection ConfigureCronServices(IServiceCollection services, Type item, IServiceProvider serviceProvider) { var cronParameters = FindServiceParameter(services, item.Name); + if (string.IsNullOrWhiteSpace(cronParameters.Item1)) + return services; var ctors = item.GetConstructors().FirstOrDefault(); var parameters = ctors.GetParameters(); List ctorServices = new List();