Bläddra i källkod

Merge pull request #1121 from PJB3005/20-01-03-recursive-generics

Fix another case of infinite generics recursion.
Daniel C. Weber 5 år sedan
förälder
incheckning
82d2cc44f3
1 ändrade filer med 6 tillägg och 4 borttagningar
  1. 6 4
      Rx.NET/Source/src/System.Reactive/Concurrency/CatchScheduler.cs

+ 6 - 4
Rx.NET/Source/src/System.Reactive/Concurrency/CatchScheduler.cs

@@ -76,15 +76,17 @@ namespace System.Reactive.Concurrency
 
             public IDisposable ScheduleLongRunning<TState>(TState state, Action<TState, ICancelable> action)
             {
+                // Note that avoiding closure allocation here would introduce infinite generic recursion over the TState argument
+                
                 return _scheduler.ScheduleLongRunning(
-                    (scheduler: this, action, state),
-                    (tuple, cancel) =>
+                    state,
+                    (state1, cancel) =>
                     {
                         try
                         {
-                            tuple.action(tuple.state, cancel);
+                            action(state1, cancel);
                         }
-                        catch (TException exception) when (tuple.scheduler._handler(exception))
+                        catch (TException exception) when (_handler(exception))
                         {
                         }
                     });