Hi,
With Hangfire Pro 1.4.8 and Hangfire 1.6.8, I’m seeing any calls to ContinueWith within a TransactionScope escalate to a DTC transaction. Presumably this is because of 2 simulataneous connections, as in https://github.com/HangfireIO/Hangfire/issues/442.
You can replicate it with this minimal code:
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
using (var ts = new TransactionScope(TransactionScopeOption.Required, TransactionScopeAsyncFlowOption.Suppress))
{
JobStorage.Current = new SqlServerStorage(@"Data Source=.\sqlexpress;Initial Catalog=blah;Integrated Security=True;Application Name=Background;Connection Timeout=120");
GlobalConfiguration.Configuration.UseBatches();
var batchClient = new BatchJobClient();
var batchId = batchClient.StartNew((client) => client.Schedule(() => Test.Method1(), DateTimeOffset.Now));
batchClient.ContinueWith(batchId, c => c.Enqueue(() => Test.Method1()));
}
}
public static class Test
{
public static void Method1()
{
}
}
}
Any workarounds or fixes would be much appreciated.
Gareth