Skip to content

Commit

Permalink
Avoid infinite generics recursion in SynchronizationContextScheduler
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jkotas authored and Oren Novotny committed Dec 24, 2019
1 parent 977d59f commit 67d891d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Fun
return Schedule(state, action);
}

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

0 comments on commit 67d891d

Please sign in to comment.