diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/Synchronization.ObserveOn.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/Synchronization.ObserveOn.cs index 2b801dedd..33b11c850 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/Synchronization.ObserveOn.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/Synchronization.ObserveOn.cs @@ -12,6 +12,7 @@ class ObserveOn : Producer { private readonly IObservable _source; private readonly IScheduler _scheduler; + private readonly SynchronizationContext _context; public ObserveOn(IObservable source, IScheduler scheduler) { @@ -19,20 +20,15 @@ public ObserveOn(IObservable source, IScheduler scheduler) _scheduler = scheduler; } -#if !NO_SYNCCTX - private readonly SynchronizationContext _context; - public ObserveOn(IObservable source, SynchronizationContext context) { _source = source; _context = context; } -#endif [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Justification = "Visibility restricted to friend assemblies. Those should be correct by inspection.")] protected override IDisposable Run(IObserver observer, IDisposable cancel, Action setSink) { -#if !NO_SYNCCTX if (_context != null) { var sink = new ObserveOnSink(this, observer, cancel); @@ -40,7 +36,6 @@ protected override IDisposable Run(IObserver observer, IDisposable canc return sink.Run(); } else -#endif { var sink = new ObserveOnObserver(_scheduler, observer, cancel); setSink(sink); @@ -48,7 +43,6 @@ protected override IDisposable Run(IObserver observer, IDisposable canc } } -#if !NO_SYNCCTX class ObserveOnSink : Sink, IObserver { private readonly ObserveOn _parent; @@ -111,7 +105,6 @@ private void OnCompletedPosted(object ignored) base.Dispose(); } } -#endif } } #endif \ No newline at end of file diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/Synchronization.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/Synchronization.cs index a68198f6c..4beb5e2b3 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/Synchronization.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/Synchronization.cs @@ -50,7 +50,6 @@ public static IObservable SubscribeOn(IObservable sou }); } -#if !NO_SYNCCTX /// /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified synchronization context. /// @@ -81,7 +80,6 @@ public static IObservable SubscribeOn(IObservable sou return subscription; }); } -#endif #endregion @@ -109,7 +107,6 @@ public static IObservable ObserveOn(IObservable sourc #endif } -#if !NO_SYNCCTX /// /// Wraps the source sequence in order to run its observer callbacks on the specified synchronization context. /// @@ -152,7 +149,6 @@ public static IObservable ObserveOn(IObservable sourc }); #endif } -#endif #endregion diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/SynchronizationContextScheduler.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/SynchronizationContextScheduler.cs index ecca4fe6c..38c5aebf6 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/SynchronizationContextScheduler.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/SynchronizationContextScheduler.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -#if !NO_SYNCCTX using System.Reactive.Disposables; using System.Threading; @@ -98,4 +97,3 @@ public override IDisposable Schedule(TState state, TimeSpan dueTime, Fun } } } -#endif \ No newline at end of file diff --git a/Rx.NET/Source/src/System.Reactive/Disposables/ContextDisposable.cs b/Rx.NET/Source/src/System.Reactive/Disposables/ContextDisposable.cs index 8f5dcf351..9b640efa5 100644 --- a/Rx.NET/Source/src/System.Reactive/Disposables/ContextDisposable.cs +++ b/Rx.NET/Source/src/System.Reactive/Disposables/ContextDisposable.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -#if !NO_SYNCCTX using System.Reactive.Concurrency; using System.Threading; @@ -63,4 +62,3 @@ public void Dispose() } } } -#endif \ No newline at end of file diff --git a/Rx.NET/Source/src/System.Reactive/Internal/SynchronizationContextExtensions.cs b/Rx.NET/Source/src/System.Reactive/Internal/SynchronizationContextExtensions.cs index 5950ab132..c9f6ab87f 100644 --- a/Rx.NET/Source/src/System.Reactive/Internal/SynchronizationContextExtensions.cs +++ b/Rx.NET/Source/src/System.Reactive/Internal/SynchronizationContextExtensions.cs @@ -2,7 +2,10 @@ // The .NET Foundation licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -#if !NO_SYNCCTX +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Threading; namespace System.Reactive.Concurrency @@ -50,4 +53,3 @@ public static void PostWithStartComplete(this SynchronizationContext context, Ac } } } -#endif \ No newline at end of file diff --git a/Rx.NET/Source/src/System.Reactive/Linq/IQueryLanguage.cs b/Rx.NET/Source/src/System.Reactive/Linq/IQueryLanguage.cs index 26d3a693c..2f31933ba 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/IQueryLanguage.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/IQueryLanguage.cs @@ -380,13 +380,11 @@ internal interface IQueryLanguage #region * Concurrency * IObservable ObserveOn(IObservable source, IScheduler scheduler); -#if !NO_SYNCCTX IObservable ObserveOn(IObservable source, SynchronizationContext context); -#endif + IObservable SubscribeOn(IObservable source, IScheduler scheduler); -#if !NO_SYNCCTX IObservable SubscribeOn(IObservable source, SynchronizationContext context); -#endif + IObservable Synchronize(IObservable source); IObservable Synchronize(IObservable source, object gate); diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable.Concurrency.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable.Concurrency.cs index 066b53a39..55aaa5a4b 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable.Concurrency.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable.Concurrency.cs @@ -33,7 +33,6 @@ public static IObservable ObserveOn(this IObservable return s_impl.ObserveOn(source, scheduler); } -#if !NO_SYNCCTX /// /// Wraps the source sequence in order to run its observer callbacks on the specified synchronization context. /// @@ -55,7 +54,6 @@ public static IObservable ObserveOn(this IObservable return s_impl.ObserveOn(source, context); } -#endif #endregion @@ -84,7 +82,6 @@ public static IObservable SubscribeOn(this IObservable(source, scheduler); } -#if !NO_SYNCCTX /// /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified synchronization context. This operation is not commonly used; /// see the remarks section for more information on the distinction between SubscribeOn and ObserveOn. @@ -107,7 +104,6 @@ public static IObservable SubscribeOn(this IObservable(source, context); } -#endif #endregion diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/ObserveOn.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/ObserveOn.cs index a329aec88..4a713ea5a 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/ObserveOn.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/ObserveOn.cs @@ -13,6 +13,7 @@ class ObserveOn : Producer { private readonly IObservable _source; private readonly IScheduler _scheduler; + private readonly SynchronizationContext _context; public ObserveOn(IObservable source, IScheduler scheduler) { @@ -20,19 +21,14 @@ public ObserveOn(IObservable source, IScheduler scheduler) _scheduler = scheduler; } -#if !NO_SYNCCTX - private readonly SynchronizationContext _context; - public ObserveOn(IObservable source, SynchronizationContext context) { _source = source; _context = context; } -#endif protected override IDisposable Run(IObserver observer, IDisposable cancel, Action setSink) { -#if !NO_SYNCCTX if (_context != null) { var sink = new ObserveOnImpl(this, observer, cancel); @@ -40,7 +36,6 @@ protected override IDisposable Run(IObserver observer, IDisposable canc return _source.Subscribe(sink); } else -#endif { var sink = new ObserveOnObserver(_scheduler, observer, cancel); setSink(sink); @@ -48,7 +43,6 @@ protected override IDisposable Run(IObserver observer, IDisposable canc } } -#if !NO_SYNCCTX class ObserveOnImpl : Sink, IObserver { private readonly ObserveOn _parent; @@ -85,7 +79,6 @@ public void OnCompleted() }); } } -#endif } } #endif \ No newline at end of file diff --git a/Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Concurrency.cs b/Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Concurrency.cs index 39009ea6a..ffd869874 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Concurrency.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Concurrency.cs @@ -21,12 +21,10 @@ public virtual IObservable ObserveOn(IObservable sour return Synchronization.ObserveOn(source, scheduler); } -#if !NO_SYNCCTX public virtual IObservable ObserveOn(IObservable source, SynchronizationContext context) { return Synchronization.ObserveOn(source, context); } -#endif #endregion @@ -37,12 +35,10 @@ public virtual IObservable SubscribeOn(IObservable so return Synchronization.SubscribeOn(source, scheduler); } -#if !NO_SYNCCTX public virtual IObservable SubscribeOn(IObservable source, SynchronizationContext context) { return Synchronization.SubscribeOn(source, context); } -#endif #endregion diff --git a/Rx.NET/Source/src/System.Reactive/Observer.Extensions.cs b/Rx.NET/Source/src/System.Reactive/Observer.Extensions.cs index ce7dd1b48..8aaed6ba5 100644 --- a/Rx.NET/Source/src/System.Reactive/Observer.Extensions.cs +++ b/Rx.NET/Source/src/System.Reactive/Observer.Extensions.cs @@ -258,7 +258,6 @@ public static IObserver NotifyOn(this IObserver observer, IScheduler sc return new ObserveOnObserver(scheduler, observer, null); } -#if !NO_SYNCCTX /// /// Schedules the invocation of observer methods on the given synchonization context. /// @@ -276,8 +275,7 @@ public static IObserver NotifyOn(this IObserver observer, Synchronizati return new ObserveOnObserver(new SynchronizationContextScheduler(context), observer, null); } -#endif - + /// /// Converts an observer to a progress object. ///