face-it/Hangfire.Tags

FaceIT.Hangfire.Tags.SqlServer breaks with Hangfire.SqlServer 1.8.15

Closed this issue · 12 comments

After upgrading Hangfire.SqlServer to version 1.8.15, this package no longer works. The following error gets logged when trying to execute a task:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Hangfire.Tags.SqlServer.SqlTagsTransaction..ctor(SqlServerStorageOptions options, IWriteOnlyTransaction transaction)
   at Hangfire.Tags.SqlServer.SqlTagsServiceStorage.GetTransaction(IWriteOnlyTransaction transaction)
   at Hangfire.Tags.Storage.TagExpirationTransaction.Persist(String jobid)
   at Hangfire.Tags.States.TagsCleanupStateFilter.OnStateApplied(ApplyStateContext context, IWriteOnlyTransaction transaction)
   at Hangfire.States.StateMachine.InvokeOnStateApplied(KeyValuePair`2 x) in C:\projects\hangfire-525\src\Hangfire.Core\States\StateMachine.cs:line 116

The root cause lies in this bit of reflection:

if (_sqlCommandBatchParameter == null)
{
_sqlCommandBatchParameter = Type.GetType("Hangfire.SqlServer.SqlCommandBatchParameter, Hangfire.SqlServer");
_sqlCommandBatchParameterCtor =
_sqlCommandBatchParameter.GetConstructor(new Type[] {typeof(string), typeof(DbType), typeof(int?)});
_sqlCommandBatchParameterValue = _sqlCommandBatchParameter.GetProperty("Value");
}
as it tries to get the SqlCommandBatchParameter type, which no longer exists in Hangfire.SqlServer 1.8.15.

facing same problem ...

Has this gotten any attention?

I haven’t had the time yet, unfortunately, but it’s high om the list!

I have the same issue, so following in interest

Same problem here

+1

Can you try this beta package? Let me know if it works, so I can publish a stable version instead:

https://www.nuget.org/packages/FaceIT.Hangfire.Tags.SqlServer/1.9.15-beta.1 (if the package is not visible yet, it'll be within the hour!)

Can you try this beta package? Let me know if it works, so I can publish a stable version instead:

https://www.nuget.org/packages/FaceIT.Hangfire.Tags.SqlServer/1.9.15-beta.1 (if the package is not visible yet, it'll be within the hour!)

For me the exception is gone. I would say it works. Will deploy to the dev environment and give further feedback.

Works well for me with Hangfire.SqlServer 1.8.17.

Thanks for the effort.

Looks good. Thanks!