Skip to content

Commit

Permalink
Merge pull request #1177 from hez2010/master
Browse files Browse the repository at this point in the history
Fix infinite recursive generics in CatchScheduler
  • Loading branch information
clairernovotny authored Apr 2, 2020
2 parents 9199d92 + a4bc99f commit f867e71
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ public PeriodicallyScheduledWorkItem(CatchSchedulerPeriodic scheduler, TState st
_catchScheduler = scheduler;
_action = action;

Disposable.SetSingle(ref _cancel, scheduler._scheduler.SchedulePeriodic((@this: this, state), period, tuple => tuple.@this?.Tick(tuple.state) ?? default));
// Note that avoiding closure allocation here would introduce infinite generic recursion over the TState argument
Disposable.SetSingle(ref _cancel, scheduler._scheduler.SchedulePeriodic(state, period, state1 => this.Tick(state1).state ?? default));
}

public void Dispose()
Expand Down

0 comments on commit f867e71

Please sign in to comment.