face-it / Hangfire.Tags

Add tags to Hangfire backgroundjobs
MIT License
92 stars 26 forks source link

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

Open AlexMedia opened 4 weeks ago

AlexMedia commented 4 weeks ago

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: https://github.com/face-it/Hangfire.Tags/blob/5038a69e3a8496168320590fd22fc8789c5de791/src/FaceIT.Hangfire.Tags.SqlServer/SqlTagsTransaction.cs#L71-L77 as it tries to get the SqlCommandBatchParameter type, which no longer exists in Hangfire.SqlServer 1.8.15.

smadep commented 3 weeks ago

facing same problem ...

HernJer commented 3 days ago

Has this gotten any attention?

erwin-faceit commented 3 days ago

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

hiblen commented 1 day ago

I have the same issue, so following in interest

aldrashan commented 10 hours ago

Same problem here