Skip to content

Commit 67d891d

Browse files
jkotasOren Novotny
authored andcommitted
Avoid infinite generics recursion in SynchronizationContextScheduler
The infinitive generics recursion interacts poorly with AOT. The AOT compilers have hard figuring out where the stop generating the code for generics with infinite recursion. They either fail or produce large images by giving up once the generics get too complex. This change reverts a small part of #500 that introduced infinite generic recursion and adds comment. Fixes dotnet/corert#7920
1 parent 977d59f commit 67d891d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Fun
9393
return Schedule(state, action);
9494
}
9595

96-
return DefaultScheduler.Instance.Schedule((scheduler: this, action, state), dt, (_, tuple) => tuple.scheduler.Schedule(tuple.state, tuple.action));
96+
// Note that avoiding closure allocation here would introduce infinite generic recursion over the TState argument
97+
return DefaultScheduler.Instance.Schedule(state, dt, (_, state1) => Schedule(state1, action));
9798
}
9899
}
99100
}

0 commit comments

Comments
 (0)