System.FormatException: Input string was not in a correct format

sql-server
Tags: #<Tag:0x00007f69fd2c9228>

#1

Using Hangfire w/ Sql Server store on netcoreapp2.1 is throwing the following exception:

System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(ReadOnlySpan1 str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt64(ReadOnlySpan1 value, NumberStyles options, NumberFormatInfo numfmt) at Hangfire.SqlServer.SqlServerConnection.<>c__DisplayClass9_0.<GetStateData>b__0(DbConnection connection) at Hangfire.SqlServer.SqlServerStorage.UseConnection[T](DbConnection dedicatedConnection, Func2 func) at Hangfire.SqlServer.SqlServerConnection.GetStateData(String jobId)`

Initiating from this code:
// fetch the current status of the job
using (var connection = JobStorage.Current.GetConnection())
{
if (connection != null && !String.IsNullOrEmpty(jobId))
{
var state = connection.GetStateData(jobId);

It looks like GetStateData() its expecting the old style numeric job ids but is receiving an object guid style job id.

The assemblies in use:
Hangfire.AspNetCore 1.6.20
Hangfire.SqlServer 1.6.20
Hangfire.Pro 2.1.1
Hangfire.Pro.Redis 2.2.2

Do I need to also have Hangfire 1.6.20 in addition toHangfire.AspNetCore 1.6.20 ?

Thanks


#2

Any updates on this guys.
I am not unable to get any cron expression to work
Code is

  CreateExecuteDeleteRefreshPipelinesByDatabaseHangfire createExecuteDeleteRefreshPipelinesByDatabaseHangfireRecurring
           = new CreateExecuteDeleteRefreshPipelinesByDatabaseHangfire(_pipelineAppService, _appConfiguration);
        
        RecurringJob.AddOrUpdate(periodicRefreshJob,
           () => createExecuteDeleteRefreshPipelinesByDatabaseHangfireRecurring.Execute(_providerProcessContext), cronExpression);

My cronExpression evaluates to
0 3 */6 * *

but even Cron.MonthlyInterval(6) gives this error.
I need to run a job every 6 months
The error is
Hangfire.BackgroundJobClientException
HResult=0x80131500
Message=Background job creation failed. See inner exception for details.
Source=Hangfire.Core
StackTrace:
at Hangfire.BackgroundJobClient.Create(Job job, IState state)
at Hangfire.BackgroundJob.ContinueWith(String parentId, Expression`1 methodCall)
at Transport.CTABS.Web.Controllers.HomeController.RefreshPeriodic() in C:\Projects\CTABSSrc\WebApplications\Transport.CTABS.01112018\Transport.CTABS.Web.Mvc\Controllers\HomeController.cs:line 320
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__12.MoveNext()

Inner Exception 1:
FormatException: Input string was not in a correct format.