Open Closed

Unexpected end of expression in Volo.Abp.AuditLogging.AbpAuditLoggingApplicationModule, Volo.Abp.AuditLogging.Application, Version=9.3.4.0 #9947


User avatar
0
trendline created
  • Exception message and full stack trace:2025-09-28 05:01:50.206 +08:00 [FTL] Host terminated unexpectedly! Volo.Abp.AbpInitializationException: An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module Volo.Abp.AuditLogging.AbpAuditLoggingApplicationModule, Volo.Abp.AuditLogging.Application, Version=9.3.4.0, Culture=neutral, PublicKeyToken=null: Unexpected end of expression.. See the inner exception for details. ---> System.FormatException: Unexpected end of expression. at Quartz.CronExpression.BuildExpression(String expression) at Quartz.CronExpression..ctor(String cronExpression) at Quartz.CronExpression.ValidateExpression(String cronExpression) at Quartz.CronScheduleBuilder.CronSchedule(String cronExpression) at Quartz.CronScheduleTriggerBuilderExtensions.WithCronSchedule(TriggerBuilder triggerBuilder, String cronExpression) at Volo.Abp.BackgroundWorkers.Quartz.QuartzPeriodicBackgroundWorkerAdapter1.BuildWorker(IBackgroundWorker worker) at Volo.Abp.BackgroundWorkers.Quartz.QuartzBackgroundWorkerManager.ReScheduleJobAsync(IBackgroundWorker worker, CancellationToken cancellationToken) at Volo.Abp.BackgroundWorkers.Quartz.QuartzBackgroundWorkerManager.AddAsync(IBackgroundWorker worker, CancellationToken cancellationToken) at Volo.Abp.AuditLogging.AbpAuditLoggingApplicationModule.OnApplicationInitializationAsync(ApplicationInitializationContext context) at Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor.InitializeAsync(ApplicationInitializationContext context, IAbpModule module) at Volo.Abp.Modularity.ModuleManager.InitializeModulesAsync(ApplicationInitializationContext context) --- End of inner exception stack trace --- at Volo.Abp.Modularity.ModuleManager.InitializeModulesAsync(ApplicationInitializationContext context) at Volo.Abp.AbpApplicationBase.InitializeModulesAsync() at Volo.Abp.AbpApplicationWithExternalServiceProvider.InitializeAsync(IServiceProvider serviceProvider) at Microsoft.AspNetCore.Builder.AbpApplicationBuilderExtensions.InitializeApplicationAsync(IApplicationBuilder app) at Viewtance.FM.Program.Main(String[] args) in D:\Source\Repos\apps\Viewtance.FM\src\Viewtance.FM.HttpApi.Host\Program.cs:line 58 `
  • Steps to reproduce the issue: Debug Host project in a tired solution, host project failed to start.

3 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • The error Unexpected end of expression from Quartz.CronExpression indicates that a Quartz background worker in your solution is configured with an invalid or empty CRON expression. This is commonly caused by a missing or misconfigured CRON schedule string in your background worker registration, often in the audit logging or a custom background worker.

    To resolve this:

    1. Check Audit Logging and Background Worker Configuration

      • Review your appsettings.json and any code that configures background workers, especially those using Quartz and the audit logging module.
      • Look for any CRON expressions that are empty, null, or malformed. For example, "Cron": "" or missing the Cron property.
    2. Example: Correct CRON Configuration

    "AbpBackgroundWorker": {
         "AuditLogWorker": {
           "IsEnabled": true,
           "Cron": "0 0 * * * ?" // Every hour, as an example
         }
       }
    
    • Ensure every worker that uses a CRON schedule has a valid expression.
    1. Check for Custom Workers

      • If you have custom background workers using Quartz, verify their CRON expressions in both code and configuration.
    2. Validate CRON Expressions

      • Use a CRON expression validator to ensure correctness. Quartz uses the format with seconds: "0 0/5 * * * ?" (every 5 minutes).
    3. Restart the Application

      • After correcting the configuration, restart your host project.

    Sources:

    • https://abp.io/docs/9.2/release-info/migration-guides/abp-9-2
    • https://abp.io/community/articles/jpq072nh

    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    trendline created

    Resolved by added below code in ConfigureServices: `
    Configure

            // This Cron expression only works if Hangfire or Quartz is used for background workers.
            // The Hangfire Cron expression is different from the Quartz Cron expression, Please refer to the following links:
            // https://www.quartz-scheduler.net/documentation/quartz-3.x/tutorial/crontriggers.html#cron-expressions
            // https://docs.hangfire.io/en/latest/background-methods/performing-recurrent-tasks.html
            options.CronExpression = "0 2 * * * ?"; // Quartz Cron expression is "0 23 * * * ?"
        });
    

    ` The default cron expression is for Hangfire, needs to add the correct format for Quartz if you are using Quartz as background worker.

    This should add int the doc as a configuration section.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    https://github.com/abpframework/abp/pull/23561

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on October 17, 2025, 13:15