Skip to content

Commit f867e71

Browse files
Merge pull request #1177 from hez2010/master
Fix infinite recursive generics in CatchScheduler
2 parents 9199d92 + a4bc99f commit f867e71

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Rx.NET/Source/src/System.Reactive/Concurrency/CatchScheduler.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ public PeriodicallyScheduledWorkItem(CatchSchedulerPeriodic scheduler, TState st
108108
_catchScheduler = scheduler;
109109
_action = action;
110110

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

114115
public void Dispose()

0 commit comments

Comments
 (0)