Quellcode durchsuchen

Move UI and platform types out of System.Reactive

Deprecate all UI-framework-specific and platform-specific types in System.Reactive. Add various System.Reactive.Integration.... packages with the replacement types.
Ian Griffiths vor 1 Jahr
Ursprung
Commit
1146c9651e
56 geänderte Dateien mit 5172 neuen und 82 gelöschten Zeilen
  1. 78 0
      Rx.NET/Source/System.Reactive.sln
  2. 73 0
      Rx.NET/Source/src/System.Reactive.Integration.Uwp/Strings_PlatformServices.Designer.cs
  3. 123 0
      Rx.NET/Source/src/System.Reactive.Integration.Uwp/Strings_PlatformServices.resx
  4. 12 0
      Rx.NET/Source/src/System.Reactive.Integration.Uwp/Stubs.cs
  5. 56 0
      Rx.NET/Source/src/System.Reactive.Integration.Uwp/System.Reactive.Integration.Uwp.csproj
  6. 18 0
      Rx.NET/Source/src/System.Reactive.Integration.Uwp/ThreadPoolTimerExtensions.cs
  7. 184 0
      Rx.NET/Source/src/System.Reactive.Integration.Uwp/UwpThreadPoolScheduler.cs
  8. 43 0
      Rx.NET/Source/src/System.Reactive.Integration.Uwp/build/NuGet.Readme.md
  9. 213 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsForms/ControlScheduler.cs
  10. 29 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsForms/System.Reactive.Integration.WindowsForms.csproj
  11. 73 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsForms/System.Reactive.Linq/WindowsFormsControlObservable.cs
  12. 26 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsForms/build/NuGet.Readme.md
  13. 17 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/AsyncInfoExtensions.cs
  14. 276 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/AsyncInfoObservableExtensions.cs
  15. 108 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/AsyncInfoToObservableBridge.cs
  16. 266 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/CoreDispatcherScheduler.cs
  17. 29 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/EventPatternSource.cs
  18. 25 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/ITypedEventPatternSource.cs
  19. 65 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/StableCompositeDisposable.cs
  20. 81 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/Strings_WindowsThreading.Designer.cs
  21. 126 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/Strings_WindowsThreading.resx
  22. 44 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/System.Reactive.Integration.WindowsRuntime.csproj
  23. 230 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/System.Reactive.Linq/WindowsRuntimeAsyncInfoObservable.cs
  24. 315 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/System.Reactive.Linq/WindowsRuntimeCoreDispatcherObservable.cs
  25. 116 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/System.Reactive.Linq/WindowsRuntimeObservable.Events.cs
  26. 135 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/System.Reactive.Linq/WindowsRuntimeObservable.StandardSequenceOperators.cs
  27. 30 0
      Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/build/NuGet.Readme.md
  28. 215 0
      Rx.NET/Source/src/System.Reactive.Integration.Wpf/DispatcherScheduler.cs
  29. 72 0
      Rx.NET/Source/src/System.Reactive.Integration.Wpf/Strings_WindowsThreading.Designer.cs
  30. 123 0
      Rx.NET/Source/src/System.Reactive.Integration.Wpf/Strings_WindowsThreading.resx
  31. 44 0
      Rx.NET/Source/src/System.Reactive.Integration.Wpf/System.Reactive.Integration.Wpf.csproj
  32. 498 0
      Rx.NET/Source/src/System.Reactive.Integration.Wpf/System.Reactive.Linq/WpfDispatcherObservable.cs
  33. 26 0
      Rx.NET/Source/src/System.Reactive.Integration.Wpf/build/NuGet.Readme.md
  34. 1 1
      Rx.NET/Source/src/System.Reactive/Concurrency/AsyncLock.cs
  35. 30 1
      Rx.NET/Source/src/System.Reactive/Concurrency/ThreadPoolScheduler.Windows.cs
  36. 4 4
      Rx.NET/Source/src/System.Reactive/Notification.cs
  37. 10 1
      Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Concurrency/ControlScheduler.cs
  38. 8 2
      Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Concurrency/DispatcherScheduler.cs
  39. 46 3
      Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/ControlObservable.cs
  40. 107 18
      Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/DispatcherObservable.cs
  41. 8 5
      Rx.NET/Source/src/System.Reactive/Platforms/UWP/Concurrency/CoreDispatcherScheduler.cs
  42. 4 0
      Rx.NET/Source/src/System.Reactive/Platforms/UWP/EventPatternSource.cs
  43. 12 1
      Rx.NET/Source/src/System.Reactive/Platforms/UWP/Foundation/AsyncInfoExtensions.cs
  44. 9 0
      Rx.NET/Source/src/System.Reactive/Platforms/UWP/Foundation/AsyncInfoToObservableBridge.cs
  45. 55 1
      Rx.NET/Source/src/System.Reactive/Platforms/UWP/IEventPatternSource.cs
  46. 88 15
      Rx.NET/Source/src/System.Reactive/Platforms/UWP/Linq/AsyncInfoObservable.cs
  47. 104 13
      Rx.NET/Source/src/System.Reactive/Platforms/UWP/Linq/CoreDispatcherObservable.cs
  48. 70 1
      Rx.NET/Source/src/System.Reactive/Platforms/UWP/Linq/WindowsObservable.Events.cs
  49. 4 0
      Rx.NET/Source/src/System.Reactive/Platforms/UWP/Linq/WindowsObservable.StandardSequenceOperators.cs
  50. 5 0
      Rx.NET/Source/tests/Tests.System.Reactive/Tests.System.Reactive.csproj
  51. 266 0
      Rx.NET/Source/tests/Tests.System.Reactive/Tests/Concurrency/ControlSchedulerTest.cs
  52. 253 0
      Rx.NET/Source/tests/Tests.System.Reactive/Tests/Concurrency/DispatcherSchedulerTest.cs
  53. 19 4
      Rx.NET/Source/tests/Tests.System.Reactive/Tests/Concurrency/SchedulerTest.cs
  54. 118 4
      Rx.NET/Source/tests/Tests.System.Reactive/Tests/Linq/Observable/ObserveOnTest.cs
  55. 152 4
      Rx.NET/Source/tests/Tests.System.Reactive/Tests/Linq/Observable/SubscribeOnTest.cs
  56. 30 4
      Rx.NET/Source/tests/Tests.System.Reactive/Tests/Linq/QbservableTest.cs

+ 78 - 0
Rx.NET/Source/System.Reactive.sln

@@ -66,6 +66,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmarks.System.Reactive"
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Benchmarks", "Benchmarks", "{C8E480ED-B592-4341-A0C9-183E822EB6B9}"
 EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FrameworkIntegrations", "FrameworkIntegrations", "{1873A545-87AA-4C22-BA1A-8A6602F65749}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Reactive.Integration.WindowsForms", "src\System.Reactive.Integration.WindowsForms\System.Reactive.Integration.WindowsForms.csproj", "{DCD4D74D-FEED-4606-B9C6-6669A5D70B85}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Reactive.Integration.Wpf", "src\System.Reactive.Integration.Wpf\System.Reactive.Integration.Wpf.csproj", "{D548C2CA-5C32-4FFF-B9E9-A251971ED7B4}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reactive.Integration.Uwp", "src\System.Reactive.Integration.Uwp\System.Reactive.Integration.Uwp.csproj", "{C3FC6098-AC7F-4825-B292-4049BC6FC76E}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Reactive.Integration.WindowsRuntime", "src\System.Reactive.Integration.WindowsRuntime\System.Reactive.Integration.WindowsRuntime.csproj", "{EB27A089-56EC-4621-BF88-E3B0DA8E6557}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -356,6 +366,70 @@ Global
 		{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|x64.Build.0 = Rx.net 4.0|Any CPU
 		{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|x86.ActiveCfg = Rx.net 4.0|Any CPU
 		{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|x86.Build.0 = Rx.net 4.0|Any CPU
+		{DCD4D74D-FEED-4606-B9C6-6669A5D70B85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{DCD4D74D-FEED-4606-B9C6-6669A5D70B85}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{DCD4D74D-FEED-4606-B9C6-6669A5D70B85}.Debug|ARM.ActiveCfg = Debug|Any CPU
+		{DCD4D74D-FEED-4606-B9C6-6669A5D70B85}.Debug|ARM.Build.0 = Debug|Any CPU
+		{DCD4D74D-FEED-4606-B9C6-6669A5D70B85}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{DCD4D74D-FEED-4606-B9C6-6669A5D70B85}.Debug|x64.Build.0 = Debug|Any CPU
+		{DCD4D74D-FEED-4606-B9C6-6669A5D70B85}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{DCD4D74D-FEED-4606-B9C6-6669A5D70B85}.Debug|x86.Build.0 = Debug|Any CPU
+		{DCD4D74D-FEED-4606-B9C6-6669A5D70B85}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{DCD4D74D-FEED-4606-B9C6-6669A5D70B85}.Release|Any CPU.Build.0 = Release|Any CPU
+		{DCD4D74D-FEED-4606-B9C6-6669A5D70B85}.Release|ARM.ActiveCfg = Release|Any CPU
+		{DCD4D74D-FEED-4606-B9C6-6669A5D70B85}.Release|ARM.Build.0 = Release|Any CPU
+		{DCD4D74D-FEED-4606-B9C6-6669A5D70B85}.Release|x64.ActiveCfg = Release|Any CPU
+		{DCD4D74D-FEED-4606-B9C6-6669A5D70B85}.Release|x64.Build.0 = Release|Any CPU
+		{DCD4D74D-FEED-4606-B9C6-6669A5D70B85}.Release|x86.ActiveCfg = Release|Any CPU
+		{DCD4D74D-FEED-4606-B9C6-6669A5D70B85}.Release|x86.Build.0 = Release|Any CPU
+		{D548C2CA-5C32-4FFF-B9E9-A251971ED7B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{D548C2CA-5C32-4FFF-B9E9-A251971ED7B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{D548C2CA-5C32-4FFF-B9E9-A251971ED7B4}.Debug|ARM.ActiveCfg = Debug|Any CPU
+		{D548C2CA-5C32-4FFF-B9E9-A251971ED7B4}.Debug|ARM.Build.0 = Debug|Any CPU
+		{D548C2CA-5C32-4FFF-B9E9-A251971ED7B4}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{D548C2CA-5C32-4FFF-B9E9-A251971ED7B4}.Debug|x64.Build.0 = Debug|Any CPU
+		{D548C2CA-5C32-4FFF-B9E9-A251971ED7B4}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{D548C2CA-5C32-4FFF-B9E9-A251971ED7B4}.Debug|x86.Build.0 = Debug|Any CPU
+		{D548C2CA-5C32-4FFF-B9E9-A251971ED7B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{D548C2CA-5C32-4FFF-B9E9-A251971ED7B4}.Release|Any CPU.Build.0 = Release|Any CPU
+		{D548C2CA-5C32-4FFF-B9E9-A251971ED7B4}.Release|ARM.ActiveCfg = Release|Any CPU
+		{D548C2CA-5C32-4FFF-B9E9-A251971ED7B4}.Release|ARM.Build.0 = Release|Any CPU
+		{D548C2CA-5C32-4FFF-B9E9-A251971ED7B4}.Release|x64.ActiveCfg = Release|Any CPU
+		{D548C2CA-5C32-4FFF-B9E9-A251971ED7B4}.Release|x64.Build.0 = Release|Any CPU
+		{D548C2CA-5C32-4FFF-B9E9-A251971ED7B4}.Release|x86.ActiveCfg = Release|Any CPU
+		{D548C2CA-5C32-4FFF-B9E9-A251971ED7B4}.Release|x86.Build.0 = Release|Any CPU
+		{C3FC6098-AC7F-4825-B292-4049BC6FC76E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{C3FC6098-AC7F-4825-B292-4049BC6FC76E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{C3FC6098-AC7F-4825-B292-4049BC6FC76E}.Debug|ARM.ActiveCfg = Debug|Any CPU
+		{C3FC6098-AC7F-4825-B292-4049BC6FC76E}.Debug|ARM.Build.0 = Debug|Any CPU
+		{C3FC6098-AC7F-4825-B292-4049BC6FC76E}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{C3FC6098-AC7F-4825-B292-4049BC6FC76E}.Debug|x64.Build.0 = Debug|Any CPU
+		{C3FC6098-AC7F-4825-B292-4049BC6FC76E}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{C3FC6098-AC7F-4825-B292-4049BC6FC76E}.Debug|x86.Build.0 = Debug|Any CPU
+		{C3FC6098-AC7F-4825-B292-4049BC6FC76E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{C3FC6098-AC7F-4825-B292-4049BC6FC76E}.Release|Any CPU.Build.0 = Release|Any CPU
+		{C3FC6098-AC7F-4825-B292-4049BC6FC76E}.Release|ARM.ActiveCfg = Release|Any CPU
+		{C3FC6098-AC7F-4825-B292-4049BC6FC76E}.Release|ARM.Build.0 = Release|Any CPU
+		{C3FC6098-AC7F-4825-B292-4049BC6FC76E}.Release|x64.ActiveCfg = Release|Any CPU
+		{C3FC6098-AC7F-4825-B292-4049BC6FC76E}.Release|x64.Build.0 = Release|Any CPU
+		{C3FC6098-AC7F-4825-B292-4049BC6FC76E}.Release|x86.ActiveCfg = Release|Any CPU
+		{C3FC6098-AC7F-4825-B292-4049BC6FC76E}.Release|x86.Build.0 = Release|Any CPU
+		{EB27A089-56EC-4621-BF88-E3B0DA8E6557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{EB27A089-56EC-4621-BF88-E3B0DA8E6557}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{EB27A089-56EC-4621-BF88-E3B0DA8E6557}.Debug|ARM.ActiveCfg = Debug|Any CPU
+		{EB27A089-56EC-4621-BF88-E3B0DA8E6557}.Debug|ARM.Build.0 = Debug|Any CPU
+		{EB27A089-56EC-4621-BF88-E3B0DA8E6557}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{EB27A089-56EC-4621-BF88-E3B0DA8E6557}.Debug|x64.Build.0 = Debug|Any CPU
+		{EB27A089-56EC-4621-BF88-E3B0DA8E6557}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{EB27A089-56EC-4621-BF88-E3B0DA8E6557}.Debug|x86.Build.0 = Debug|Any CPU
+		{EB27A089-56EC-4621-BF88-E3B0DA8E6557}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{EB27A089-56EC-4621-BF88-E3B0DA8E6557}.Release|Any CPU.Build.0 = Release|Any CPU
+		{EB27A089-56EC-4621-BF88-E3B0DA8E6557}.Release|ARM.ActiveCfg = Release|Any CPU
+		{EB27A089-56EC-4621-BF88-E3B0DA8E6557}.Release|ARM.Build.0 = Release|Any CPU
+		{EB27A089-56EC-4621-BF88-E3B0DA8E6557}.Release|x64.ActiveCfg = Release|Any CPU
+		{EB27A089-56EC-4621-BF88-E3B0DA8E6557}.Release|x64.Build.0 = Release|Any CPU
+		{EB27A089-56EC-4621-BF88-E3B0DA8E6557}.Release|x86.ActiveCfg = Release|Any CPU
+		{EB27A089-56EC-4621-BF88-E3B0DA8E6557}.Release|x86.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -375,6 +449,10 @@ Global
 		{A31DDC7E-E883-4DBD-8FB8-D7DFC56059F6} = {A0F39260-B8F8-4FCB-9679-0ED917A22BDF}
 		{01CCDA6D-4D00-4DF2-82B0-359FD5E0CDC6} = {D324579D-CBE6-4867-8980-D7842C7C45A2}
 		{5C7906F6-232E-455C-9269-68EF84F393C9} = {C8E480ED-B592-4341-A0C9-183E822EB6B9}
+		{DCD4D74D-FEED-4606-B9C6-6669A5D70B85} = {1873A545-87AA-4C22-BA1A-8A6602F65749}
+		{D548C2CA-5C32-4FFF-B9E9-A251971ED7B4} = {1873A545-87AA-4C22-BA1A-8A6602F65749}
+		{C3FC6098-AC7F-4825-B292-4049BC6FC76E} = {1873A545-87AA-4C22-BA1A-8A6602F65749}
+		{EB27A089-56EC-4621-BF88-E3B0DA8E6557} = {1873A545-87AA-4C22-BA1A-8A6602F65749}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {2483F58F-A8D6-4FFE-A3C1-10F3A36DBE69}

+ 73 - 0
Rx.NET/Source/src/System.Reactive.Integration.Uwp/Strings_PlatformServices.Designer.cs

@@ -0,0 +1,73 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.42000
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace System.Reactive.Integration.Uwp {
+    using System;
+    using System.Reflection;
+    
+    
+    /// <summary>
+    ///   A strongly-typed resource class, for looking up localized strings, etc.
+    /// </summary>
+    // This class was auto-generated by the StronglyTypedResourceBuilder
+    // class via a tool like ResGen or Visual Studio.
+    // To add or remove a member, edit your .ResX file then rerun ResGen
+    // with the /str option, or rebuild your VS project.
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Strings_PlatformServices {
+        
+        private static global::System.Resources.ResourceManager resourceMan;
+        
+        private static global::System.Globalization.CultureInfo resourceCulture;
+        
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Strings_PlatformServices() {
+        }
+        
+        /// <summary>
+        ///   Returns the cached ResourceManager instance used by this class.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Reactive.Integration.Uwp.Strings_PlatformServices", typeof(Strings_PlatformServices).GetTypeInfo().Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+        
+        /// <summary>
+        ///   Overrides the current thread's CurrentUICulture property for all
+        ///   resource lookups using this strongly typed resource class.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture {
+            get {
+                return resourceCulture;
+            }
+            set {
+                resourceCulture = value;
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to The WinRT thread pool doesn&apos;t support creating periodic timers with a period below 1 millisecond..
+        /// </summary>
+        internal static string WINRT_NO_SUB1MS_TIMERS {
+            get {
+                return ResourceManager.GetString("WINRT_NO_SUB1MS_TIMERS", resourceCulture);
+            }
+        }
+    }
+}

+ 123 - 0
Rx.NET/Source/src/System.Reactive.Integration.Uwp/Strings_PlatformServices.resx

@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <data name="WINRT_NO_SUB1MS_TIMERS" xml:space="preserve">
+    <value>The WinRT thread pool doesn't support creating periodic timers with a period below 1 millisecond.</value>
+  </data>
+</root>

+ 12 - 0
Rx.NET/Source/src/System.Reactive.Integration.Uwp/Stubs.cs

@@ -0,0 +1,12 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT License.
+// See the LICENSE file in the project root for more information. 
+
+namespace System.Reactive.Integration.Uwp
+{
+    internal static class Stubs<T>
+    {
+        public static readonly Func<T, T> I = static _ => _;
+    }
+}
+

+ 56 - 0
Rx.NET/Source/src/System.Reactive.Integration.Uwp/System.Reactive.Integration.Uwp.csproj

@@ -0,0 +1,56 @@
+<Project Sdk="MSBuild.Sdk.Extras">
+
+  <!--
+  TODO: should this be an old-style project so we don't take yet another
+  dependency on MSBuild.Sdk.Extras, which we'd like to stop using?
+  -->
+  <PropertyGroup>
+    <TargetFramework>uap10.0.18362</TargetFramework>
+
+  <PackageTags>Rx;Reactive;Extensions;Observable;LINQ;Events;Windows Forms</PackageTags>
+    <Description>Reactive Extensions (Rx) for .NET</Description>
+
+    <PackageReadmeFile>readme.md</PackageReadmeFile>
+  </PropertyGroup>
+
+  <PropertyGroup>
+    <Nullable>enable</Nullable>    
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Compile Include="..\AssemblyInfo.cs" Link="Properties\AssemblyInfo.cs" />
+    <Compile Include="..\System.Reactive.Integration.WindowsRuntime\AsyncInfoExtensions.cs" Link="AsyncInfoExtensions.cs" />
+    <Compile Include="..\System.Reactive\Concurrency\UserWorkItem.cs" Link="UserWorkItem.cs" />
+    <Compile Include="..\System.Reactive\Diagnostics\CodeAnalysis\NullableAttributes.cs" Link="NullableAttributes.cs" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\System.Reactive\System.Reactive.csproj" />
+    <ProjectReference Include="..\System.Reactive.Integration.WindowsRuntime\System.Reactive.Integration.WindowsRuntime.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Compile Update="Strings_PlatformServices.Designer.cs">
+      <DependentUpon>$([MSBuild]::ValueOrDefault('%(Filename)', '').Replace('$(ExtrasDefaultDesignerFileSuffix)', '.resx'))</DependentUpon>
+    </Compile>
+  </ItemGroup>
+
+  <ItemGroup>
+    <Compile Update="Strings_PlatformServices.Designer.cs">
+      <DesignTime>True</DesignTime>
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Strings_PlatformServices.resx</DependentUpon>
+    </Compile>
+  </ItemGroup>
+
+  <ItemGroup>
+    <EmbeddedResource Update="Strings_PlatformServices.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Strings_PlatformServices.Designer.cs</LastGenOutput>
+    </EmbeddedResource>
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Include="build\NuGet.Readme.md" Pack="true" PackagePath="\readme.md" />
+  </ItemGroup>
+</Project>

+ 18 - 0
Rx.NET/Source/src/System.Reactive.Integration.Uwp/ThreadPoolTimerExtensions.cs

@@ -0,0 +1,18 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT License.
+// See the LICENSE file in the project root for more information. 
+
+using System.Reactive.Disposables;
+
+using Windows.System.Threading;
+
+namespace System.Reactive.Integration.Uwp
+{
+    internal static class ThreadPoolTimerExtensions
+    {
+        public static IDisposable AsDisposable(this ThreadPoolTimer threadPoolTimer)
+        {
+            return Disposable.Create(threadPoolTimer, static t => t!.Cancel());
+        }
+    }
+}

+ 184 - 0
Rx.NET/Source/src/System.Reactive.Integration.Uwp/UwpThreadPoolScheduler.cs

@@ -0,0 +1,184 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT License.
+// See the LICENSE file in the project root for more information. 
+
+using System.Reactive.Concurrency;
+using System.Reactive.Integration.WindowsRuntime;
+using Windows.System.Threading;
+
+namespace System.Reactive.Integration.Uwp
+{
+    /// <summary>
+    /// Schedules units of work on the Windows Runtime thread pool.
+    /// </summary>
+    /// <seealso cref="Instance">Singleton instance of this type exposed through this static property.</seealso>
+    [CLSCompliant(false)]
+    public sealed class UwpThreadPoolScheduler : LocalScheduler, ISchedulerPeriodic
+    {
+        private static readonly Lazy<UwpThreadPoolScheduler> LazyDefault = new(static () => new UwpThreadPoolScheduler());
+
+        /// <summary>
+        /// Constructs a ThreadPoolScheduler that schedules units of work on the Windows ThreadPool.
+        /// </summary>
+        public UwpThreadPoolScheduler()
+        {
+        }
+
+        /// <summary>
+        /// Constructs a ThreadPoolScheduler that schedules units of work on the Windows ThreadPool with the given priority.
+        /// </summary>
+        /// <param name="priority">Priority for scheduled units of work.</param>
+        public UwpThreadPoolScheduler(WorkItemPriority priority)
+        {
+            Priority = priority;
+            Options = WorkItemOptions.None;
+        }
+
+        /// <summary>
+        /// Constructs a ThreadPoolScheduler that schedules units of work on the Windows ThreadPool with the given priority.
+        /// </summary>
+        /// <param name="priority">Priority for scheduled units of work.</param>
+        /// <param name="options">Options that configure how work is scheduled.</param>
+        public UwpThreadPoolScheduler(WorkItemPriority priority, WorkItemOptions options)
+        {
+            Priority = priority;
+            Options = options;
+        }
+
+        /// <summary>
+        /// Gets the singleton instance of the Windows Runtime thread pool scheduler.
+        /// </summary>
+        public static UwpThreadPoolScheduler Instance => LazyDefault.Value;
+
+        /// <summary>
+        /// Gets the priority at which work is scheduled.
+        /// </summary>
+        public WorkItemPriority Priority { get; }
+
+        /// <summary>
+        /// Gets the options that configure how work is scheduled.
+        /// </summary>
+        public WorkItemOptions Options { get; }
+
+        /// <summary>
+        /// Schedules an action to be executed.
+        /// </summary>
+        /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
+        /// <param name="state">State passed to the action to be executed.</param>
+        /// <param name="action">Action to be executed.</param>
+        /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
+        public override IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
+        {
+            if (action == null)
+                throw new ArgumentNullException(nameof(action));
+
+            var userWorkItem = new UserWorkItem<TState>(this, state, action);
+            
+            var res = ThreadPool.RunAsync(
+                iaa => userWorkItem.Run(),
+                Priority,
+                Options);
+
+            userWorkItem.CancelQueueDisposable =  res.AsDisposable();
+
+            return userWorkItem;
+        }
+
+        /// <summary>
+        /// Schedules an action to be executed after dueTime, using a Windows.System.Threading.ThreadPoolTimer object.
+        /// </summary>
+        /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
+        /// <param name="state">State passed to the action to be executed.</param>
+        /// <param name="action">Action to be executed.</param>
+        /// <param name="dueTime">Relative time after which to execute the action.</param>
+        /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
+        public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
+        {
+            if (action == null)
+                throw new ArgumentNullException(nameof(action));
+
+            var dt = Scheduler.Normalize(dueTime);
+
+            if (dt.Ticks == 0)
+            {
+                return Schedule(state, action);
+            }
+
+            return ScheduleSlow(state, dt, action);
+        }
+
+        private IDisposable ScheduleSlow<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
+        {
+            var userWorkItem = new UserWorkItem<TState>(this, state, action);
+
+            var res = ThreadPoolTimer.CreateTimer(
+                tpt => userWorkItem.Run(),
+                dueTime);
+
+            userWorkItem.CancelQueueDisposable = res.AsDisposable();
+
+            return userWorkItem;
+        }
+
+        /// <summary>
+        /// Schedules a periodic piece of work, using a Windows.System.Threading.ThreadPoolTimer object.
+        /// </summary>
+        /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
+        /// <param name="state">Initial state passed to the action upon the first iteration.</param>
+        /// <param name="period">Period for running the work periodically.</param>
+        /// <param name="action">Action to be executed, potentially updating the state.</param>
+        /// <returns>The disposable object used to cancel the scheduled recurring action (best effort).</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
+        /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than one millisecond.</exception>
+        public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action)
+        {
+            //
+            // The WinRT thread pool is based on the Win32 thread pool and cannot handle
+            // sub-1ms resolution. When passing a lower period, we get single-shot
+            // timer behavior instead. See MSDN documentation for CreatePeriodicTimer
+            // for more information.
+            //
+            if (period < TimeSpan.FromMilliseconds(1))
+                throw new ArgumentOutOfRangeException(nameof(period), Strings_PlatformServices.WINRT_NO_SUB1MS_TIMERS);
+            if (action == null)
+                throw new ArgumentNullException(nameof(action));
+
+            return new PeriodicallyScheduledWorkItem<TState>(state, period, action);
+        }
+
+        private sealed class PeriodicallyScheduledWorkItem<TState> : IDisposable
+        {
+            private TState _state;
+            private Func<TState, TState> _action;
+
+            private readonly ThreadPoolTimer _timer;
+            private readonly AsyncLock _gate = new();
+
+            public PeriodicallyScheduledWorkItem(TState state, TimeSpan period, Func<TState, TState> action)
+            {
+                _state = state;
+                _action = action;
+
+                _timer = ThreadPoolTimer.CreatePeriodicTimer(
+                    Tick,
+                    period);
+            }
+
+            private void Tick(ThreadPoolTimer timer)
+            {
+                _gate.Wait(
+                    this,
+                    static @this => @this._state = @this._action(@this._state));
+            }
+
+            public void Dispose()
+            {
+                _timer.Cancel();
+                _gate.Dispose();
+                _action = Stubs<TState>.I;
+            }
+        }
+    }
+}

+ 43 - 0
Rx.NET/Source/src/System.Reactive.Integration.Uwp/build/NuGet.Readme.md

@@ -0,0 +1,43 @@
+# UWP Support for Rx.NET (Reactive Extensions for .NET)
+
+This library provides UWP (Universal Windows Platform) support for the Reactive Extensions for .NET (Rx.NET).
+
+See the main Rx.NET package at https://www.nuget.org/packages/System.Reactive for more information about Rx.NET.
+
+## Rx.NET and UI Frameworks
+
+Up as far as Rx.NET v6.0, UI framework support has been built directly into the main `System.Reactive` package.
+Unfortunately, this has caused problems since support for WPF and Windows Forms was added in .NET Core 3.1.
+Because .NET Core 3.1, and all subsequent versions of .NET have supported cross-platform use, WPF and Windows
+Forms are not universally available. Rx.NET used to make WPF and Windows Forms support if you targetted a
+sufficiently recent version of Windows in your application TFM. But this turns out to cause problems in
+some deployment models, adding as much as 90MB to the deployable size of an application.
+
+Consequently, starting in Rx.NET v7.0 we are moving all UI-framework-specific types, and also platform-specific
+types out into separate packages.
+
+## Features
+
+This package defines one public type, `UwpThreadPoolScheduler`. It provides a replacement for deprecated functionality on the
+`ThreadPoolScheduler` in the `uap10.0.18362` target of `System.Reactive`. In a future version of Rx.NET, the UWP-specific
+target will be removed the main `System.Reactive` package, at which point UWP applications will use the `netstandard2.0`
+target, and will get only the common `ThreadPoolScheduler` functionality available on all platforms.
+
+The specialized `ThreadPoolScheduler` currently still available in the `uap10.0.18362` target of `System.Reactive` is
+very nearly the same as the common one. It has some extra properties and constructors providing access to some features
+specific to the `Windows.System.Threading` thread pool (which is available only on UWP). It allows the use of
+`WorkItemPriority` and `WorkItemOptions`. These features are now deprecated on the `ThreadPoolScheduler` in the
+`uap10.0.18362` target of `System.Reactive`, making its remaining non-deprecated surface area the same as in
+other targets.
+
+Applications still needing access to the UWP-specific functionality can switch to the `UwpThreadPoolScheduler`
+in this library.
+
+
+## Windows Runtime Support
+
+The `uap10.0.18362` target of `System.Reactive` also offers support for some Windows Runtime types, such as `IAsyncOperation`,
+that are often used in UWP applications. Those types are also available outside of UWP, so they are also available in
+the Windows-specific .NET target, but they have also been deprecated, as part of the drive to remove all platform- and
+UI-framework-specific code from `System.Reactive`. You can find support for those in the `System.Reactive.Integration.WindowsRuntime`
+NuGet package.

+ 213 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsForms/ControlScheduler.cs

@@ -0,0 +1,213 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT License.
+// See the LICENSE file in the project root for more information.
+
+using System.Reactive.Concurrency;
+using System.Reactive.Disposables;
+using System.Threading;
+using System.Windows.Forms;
+
+namespace System.Reactive.Integration.WindowsForms
+{
+    /// <summary>
+    /// Represents an object that schedules units of work on the message loop associated with a Windows Forms control.
+    /// </summary>
+    public class ControlScheduler : LocalScheduler, ISchedulerPeriodic
+    {
+        private readonly Control _control;
+
+        /// <summary>
+        /// Constructs a ControlScheduler that schedules units of work on the message loop associated with the specified Windows Forms control.
+        /// </summary>
+        /// <param name="control">Windows Forms control to get the message loop from.</param>
+        /// <exception cref="ArgumentNullException"><paramref name="control"/> is null.</exception>
+        /// <remarks>
+        /// This scheduler type is typically used indirectly through the <see cref="Linq.WindowsFormsControlObservable.ObserveOnWindowsFormsControl{TSource}"/> and <see cref="Linq.WindowsFormsControlObservable.SubscribeOnWindowFormsControl{TSource}"/> method overloads that take a Windows Forms control.
+        /// </remarks>
+        public ControlScheduler(Control control)
+        {
+            _control = control ?? throw new ArgumentNullException(nameof(control));
+        }
+
+        /// <summary>
+        /// Gets the control associated with the ControlScheduler.
+        /// </summary>
+        public Control Control => _control;
+
+        /// <summary>
+        /// Schedules an action to be executed on the message loop associated with the control.
+        /// </summary>
+        /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
+        /// <param name="state">State passed to the action to be executed.</param>
+        /// <param name="action">Action to be executed.</param>
+        /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
+        public override IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
+        {
+            if (action == null)
+            {
+                throw new ArgumentNullException(nameof(action));
+            }
+
+            if (_control.IsDisposed)
+            {
+                return Disposable.Empty;
+            }
+
+            var d = new SingleAssignmentDisposable();
+
+            _control.BeginInvoke(new Action(() =>
+            {
+                if (!_control.IsDisposed && !d.IsDisposed)
+                {
+                    d.Disposable = action(this, state);
+                }
+            }));
+
+            return d;
+        }
+
+        /// <summary>
+        /// Schedules an action to be executed after dueTime on the message loop associated with the control, using a Windows Forms Timer object.
+        /// </summary>
+        /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
+        /// <param name="state">State passed to the action to be executed.</param>
+        /// <param name="action">Action to be executed.</param>
+        /// <param name="dueTime">Relative time after which to execute the action.</param>
+        /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
+        public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
+        {
+            if (action == null)
+            {
+                throw new ArgumentNullException(nameof(action));
+            }
+
+            var dt = Scheduler.Normalize(dueTime);
+            if (dt.Ticks == 0)
+            {
+                return Schedule(state, action);
+            }
+
+            var createTimer = new Func<IScheduler, TState, IDisposable>((scheduler1, state1) =>
+            {
+                var d = new MultipleAssignmentDisposable();
+
+                var timer = new System.Windows.Forms.Timer();
+
+                timer.Tick += (s, e) =>
+                {
+                    var t = Interlocked.Exchange(ref timer, null);
+                    if (t != null)
+                    {
+                        try
+                        {
+                            if (!_control.IsDisposed && !d.IsDisposed)
+                            {
+                                d.Disposable = action(scheduler1, state1);
+                            }
+                        }
+                        finally
+                        {
+                            t.Stop();
+                            action = static (s, t) => Disposable.Empty;
+                        }
+                    }
+                };
+
+                timer.Interval = (int)dt.TotalMilliseconds;
+                timer.Start();
+
+                d.Disposable = Disposable.Create(() =>
+                {
+                    var t = Interlocked.Exchange(ref timer, null);
+                    if (t != null)
+                    {
+                        t.Stop();
+                        action = static (s, t) => Disposable.Empty;
+                    }
+                });
+
+                return d;
+            });
+
+            //
+            // This check is critical. When creating and enabling a Timer object on another thread than
+            // the UI thread, it won't fire.
+            //
+            if (_control.InvokeRequired)
+            {
+                return Schedule(state, createTimer);
+            }
+            else
+            {
+                return createTimer(this, state);
+            }
+        }
+
+        /// <summary>
+        /// Schedules a periodic piece of work on the message loop associated with the control, using a Windows Forms Timer object.
+        /// </summary>
+        /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
+        /// <param name="state">Initial state passed to the action upon the first iteration.</param>
+        /// <param name="period">Period for running the work periodically.</param>
+        /// <param name="action">Action to be executed, potentially updating the state.</param>
+        /// <returns>The disposable object used to cancel the scheduled recurring action (best effort).</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
+        /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than one millisecond.</exception>
+        public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action)
+        {
+            //
+            // Threshold derived from Interval property setter in ndp\fx\src\winforms\managed\system\winforms\Timer.cs.
+            //
+            if (period.TotalMilliseconds < 1)
+            {
+                throw new ArgumentOutOfRangeException(nameof(period));
+            }
+
+            if (action == null)
+            {
+                throw new ArgumentNullException(nameof(action));
+            }
+
+            var createTimer = new Func<IScheduler, TState, IDisposable>((scheduler1, state1) =>
+            {
+                var timer = new System.Windows.Forms.Timer();
+
+                timer.Tick += (s, e) =>
+                {
+                    if (!_control.IsDisposed)
+                    {
+                        state1 = action(state1);
+                    }
+                };
+
+                timer.Interval = (int)period.TotalMilliseconds;
+                timer.Start();
+
+                return Disposable.Create(() =>
+                {
+                    var t = Interlocked.Exchange(ref timer, null);
+                    if (t != null)
+                    {
+                        t.Stop();
+                        action = static _ => _;
+                    }
+                });
+            });
+
+            //
+            // This check is critical. When creating and enabling a Timer object on another thread than
+            // the UI thread, it won't fire.
+            //
+            if (_control.InvokeRequired)
+            {
+                return Schedule(state, createTimer);
+            }
+            else
+            {
+                return createTimer(this, state);
+            }
+        }
+    }
+}

+ 29 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsForms/System.Reactive.Integration.WindowsForms.csproj

@@ -0,0 +1,29 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFrameworks>net472;net6.0-windows</TargetFrameworks>
+    <UseWindowsForms>true</UseWindowsForms>
+
+    <PackageTags>Rx;Reactive;Extensions;Observable;LINQ;Events;Windows Forms</PackageTags>
+    <Description>Reactive Extensions (Rx) for .NET</Description>
+
+    <PackageReadmeFile>readme.md</PackageReadmeFile>
+  </PropertyGroup>
+
+  <PropertyGroup>
+    <Nullable>enable</Nullable>    
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Compile Include="..\AssemblyInfo.cs" Link="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\System.Reactive\System.Reactive.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Include="build\NuGet.Readme.md" Pack="true" PackagePath="\readme.md" />
+  </ItemGroup>
+
+</Project>

+ 73 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsForms/System.Reactive.Linq/WindowsFormsControlObservable.cs

@@ -0,0 +1,73 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT License.
+// See the LICENSE file in the project root for more information. 
+
+using System.Windows.Forms;
+
+using ControlScheduler = System.Reactive.Integration.WindowsForms.ControlScheduler;
+using Synchronization = System.Reactive.Concurrency.Synchronization;
+
+namespace System.Reactive.Linq
+{
+    /// <summary>
+    /// Provides a set of static methods for subscribing to IObservables using Windows Forms controls.
+    /// </summary>
+    /// <remarks>
+    /// <para>
+    /// This replaces the obsolete <c>System.Reactive.Linq.ControlObservable</c> class in
+    /// <c>System.Reactive</c>.
+    /// </para>
+    /// </remarks>
+    public static class WindowsFormsControlObservable
+    {
+        /// <summary>
+        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the Windows Forms message loop associated with the specified control.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="control">Windows Forms control whose associated message loop is used to perform subscription and unsubscription actions on.</param>
+        /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the Windows Forms message loop associated with the specified control.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="control"/> is null.</exception>
+        /// <remarks>
+        /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the specified control.
+        /// In order to invoke observer callbacks on the specified control, e.g. to render results in a control, use <see cref="ObserveOnWindowsFormsControl"/>.
+        /// </remarks>
+        public static IObservable<TSource> SubscribeOnWindowFormsControl<TSource>(this IObservable<TSource> source, Control control)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (control == null)
+            {
+                throw new ArgumentNullException(nameof(control));
+            }
+
+            return Synchronization.SubscribeOn(source, new ControlScheduler(control));
+        }
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its observer callbacks on the Windows Forms message loop associated with the specified control.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="control">Windows Forms control whose associated message loop is used to notify observers on.</param>
+        /// <returns>The source sequence whose observations happen on the Windows Forms message loop associated with the specified control.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="control"/> is null.</exception>
+        public static IObservable<TSource> ObserveOnWindowsFormsControl<TSource>(this IObservable<TSource> source, Control control)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (control == null)
+            {
+                throw new ArgumentNullException(nameof(control));
+            }
+
+            return Synchronization.ObserveOn(source, new ControlScheduler(control));
+        }
+    }
+}

+ 26 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsForms/build/NuGet.Readme.md

@@ -0,0 +1,26 @@
+# Windows Forms Support for Rx.NET (Reactive Extensions for .NET)
+
+This library provides Windows Forms support for the Reactive Extensions for .NET (Rx.NET).
+
+See the main Rx.NET package at https://www.nuget.org/packages/System.Reactive for more information about Rx.NET.
+
+## Rx.NET and UI Frameworks
+
+Up as far as Rx.NET v6.0, UI framework support has been built directly into the main `System.Reactive` package.
+Unfortunately, this has caused problems since support for WPF and Windows Forms was added in .NET Core 3.1.
+Because .NET Core 3.1, and all subsequent versions of .NET have supported cross-platform use, WPF and Windows
+Forms are not universally available. Rx.NET used to make WPF and Windows Forms support if you targetted a
+sufficiently recent version of Windows in your application TFM. But this turns out to cause problems in
+some deployment models, adding as much as 90MB to the deployable size of an application.
+
+Consequently, starting in Rx.NET v7.0 we are moving all UI-framework-specific types, and also platform-specific
+types out into separate packages.
+
+## Features
+
+This package provides replacements for two deprecated types in `System.Reactive`:
+
+|Type in `System.Reactive` | Replacement | Purpose |
+|---|---|---|
+|`ControlScheduler` (in `System.Reactive.Concurrency`) | `ControlScheduler` (in `System.Reactive.Integration.WindowsForms`) | Provides a scheduler that schedules work on the UI thread of a Windows Forms application. |
+|`ControlObservable` (in `System.Reactive.Linq`) | `WindowsFormsControlObservable` (in `System.Reactive.Linq`) | Provides a set of extension methods for scheduling work on the UI thread of a Windows Forms application. |

+ 17 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/AsyncInfoExtensions.cs

@@ -0,0 +1,17 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT License.
+// See the LICENSE file in the project root for more information. 
+
+using System.Reactive.Disposables;
+using Windows.Foundation;
+
+namespace System.Reactive.Integration.WindowsRuntime
+{
+    internal static class AsyncInfoExtensions
+    {
+        public static IDisposable AsDisposable(this IAsyncInfo asyncInfo)
+        {
+            return Disposable.Create(asyncInfo, static i => i!.Cancel());
+        }
+    }
+}

+ 276 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/AsyncInfoObservableExtensions.cs

@@ -0,0 +1,276 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT License.
+// See the LICENSE file in the project root for more information. 
+
+using System.Reactive.Linq;
+using Windows.Foundation;
+
+namespace System.Reactive.Integration.WindowsRuntime
+{
+    /// <summary>
+    /// Provides conversions from Windows Runtime asynchronous actions and operations to observable sequences.
+    /// </summary>
+    [CLSCompliant(false)]
+    public static class AsyncInfoObservableExtensions
+    {
+        #region IAsyncAction and IAsyncActionWithProgress
+
+        /// <summary>
+        /// Converts a Windows Runtime asynchronous action to an observable sequence.
+        /// Each observer subscribed to the resulting observable sequence will be notified about the action's successful or exceptional completion.
+        /// </summary>
+        /// <param name="source">Asynchronous action to convert.</param>
+        /// <returns>An observable sequence that produces a unit value when the asynchronous action completes, or propagates the exception produced by the asynchronous action.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        public static IObservable<Unit> ToObservable(this IAsyncAction source)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return new AsyncInfoToObservableBridge<Unit, Unit>(
+                source,
+                static (iai, a) => ((IAsyncAction)iai).Completed += new AsyncActionCompletedHandler((iaa, status) => a(iaa, status)),
+                iai => Unit.Default,
+                onProgress: null,
+                progress: null,
+                multiValue: false
+            );
+        }
+
+        /// <summary>
+        /// Converts a Windows Runtime asynchronous action to an observable sequence, ignoring its progress notifications.
+        /// Each observer subscribed to the resulting observable sequence will be notified about the action's successful or exceptional completion.
+        /// </summary>
+        /// <typeparam name="TProgress">The type of the reported progress objects, which get ignored by this conversion.</typeparam>
+        /// <param name="source">Asynchronous action to convert.</param>
+        /// <returns>An observable sequence that produces a unit value when the asynchronous action completes, or propagates the exception produced by the asynchronous action.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        public static IObservable<Unit> ToObservable<TProgress>(this IAsyncActionWithProgress<TProgress> source)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return source.ToObservable_(null);
+        }
+
+        /// <summary>
+        /// Converts a Windows Runtime asynchronous action to an observable sequence, reporting its progress through the supplied progress object.
+        /// Each observer subscribed to the resulting observable sequence will be notified about the action's successful or exceptional completion.
+        /// </summary>
+        /// <typeparam name="TProgress">The type of the reported progress objects.</typeparam>
+        /// <param name="source">Asynchronous action to convert.</param>
+        /// <param name="progress">Progress object to receive progress notifications on.</param>
+        /// <returns>An observable sequence that produces a unit value when the asynchronous action completes, or propagates the exception produced by the asynchronous action.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="progress"/> is null.</exception>
+        public static IObservable<Unit> ToObservable<TProgress>(this IAsyncActionWithProgress<TProgress> source, IProgress<TProgress> progress)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (progress == null)
+            {
+                throw new ArgumentNullException(nameof(progress));
+            }
+
+            return source.ToObservable_(progress);
+        }
+
+        /// <summary>
+        /// Converts a Windows Runtime asynchronous action to an observable sequence reporting its progress.
+        /// Each observer subscribed to the resulting observable sequence will be notified about the action's successful or exceptional completion.
+        /// </summary>
+        /// <typeparam name="TProgress">The type of the reported progress objects.</typeparam>
+        /// <param name="source">Asynchronous action to convert.</param>
+        /// <returns>An observable sequence that produces progress values from the asynchronous action and notifies observers about the action's completion.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        public static IObservable<TProgress> ToObservableProgress<TProgress>(this IAsyncActionWithProgress<TProgress> source)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return Observable.Create<TProgress>(observer =>
+            {
+                var progress = observer.ToProgress();
+                var src = source.ToObservable_(progress);
+                return src.Subscribe(static _ => { }, observer.OnError, observer.OnCompleted);
+            });
+        }
+
+        private static IObservable<Unit> ToObservable_<TProgress>(this IAsyncActionWithProgress<TProgress> source, IProgress<TProgress>? progress)
+        {
+            return new AsyncInfoToObservableBridge<Unit, TProgress>(
+                source,
+                static (iai, a) => ((IAsyncActionWithProgress<TProgress>)iai).Completed += new AsyncActionWithProgressCompletedHandler<TProgress>((iaa, status) => a(iaa, status)),
+                iai => Unit.Default,
+                static (iai, a) => ((IAsyncActionWithProgress<TProgress>)iai).Progress += new AsyncActionProgressHandler<TProgress>((iap, p) => a(iap, p)),
+                progress,
+                multiValue: false
+            );
+        }
+
+        #endregion
+
+        #region IAsyncOperation and IAsyncOperationWithProgress
+
+        /// <summary>
+        /// Converts a Windows Runtime asynchronous operation to an observable sequence reporting its result.
+        /// Each observer subscribed to the resulting observable sequence will be notified about the operation's single result and its successful exceptional completion.
+        /// </summary>
+        /// <typeparam name="TResult">The type of the asynchronous operation's result.</typeparam>
+        /// <param name="source">Asynchronous operation to convert.</param>
+        /// <returns>An observable sequence that notifies observers about the asynchronous operation's result value and completion.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        public static IObservable<TResult> ToObservable<TResult>(this IAsyncOperation<TResult> source)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return new AsyncInfoToObservableBridge<TResult, Unit>(
+                source,
+                static (iai, a) => ((IAsyncOperation<TResult>)iai).Completed += new AsyncOperationCompletedHandler<TResult>((iao, status) => a(iao, status)),
+                static iai => ((IAsyncOperation<TResult>)iai).GetResults(),
+                onProgress: null,
+                progress: null,
+                multiValue: false
+            );
+        }
+
+        /// <summary>
+        /// Converts a Windows Runtime asynchronous operation to an observable sequence reporting its result but ignoring its progress notifications.
+        /// Each observer subscribed to the resulting observable sequence will be notified about the operations's single result and its successful or exceptional completion.
+        /// </summary>
+        /// <typeparam name="TResult">The type of the asynchronous operation's result.</typeparam>
+        /// <typeparam name="TProgress">The type of the reported progress objects, which get ignored by this conversion.</typeparam>
+        /// <param name="source">Asynchronous action to convert.</param>
+        /// <returns>An observable sequence that notifies observers about the asynchronous operation's result value and completion.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        public static IObservable<TResult> ToObservable<TResult, TProgress>(this IAsyncOperationWithProgress<TResult, TProgress> source)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return source.ToObservable_(null, false);
+        }
+
+        /// <summary>
+        /// Converts a Windows Runtime asynchronous operation to an observable sequence reporting its result and reporting its progress through the supplied progress object.
+        /// Each observer subscribed to the resulting observable sequence will be notified about the operations's single result and its successful or exceptional completion.
+        /// </summary>
+        /// <typeparam name="TResult">The type of the asynchronous operation's result.</typeparam>
+        /// <typeparam name="TProgress">The type of the reported progress objects.</typeparam>
+        /// <param name="source">Asynchronous action to convert.</param>
+        /// <param name="progress">Progress object to receive progress notifications on.</param>
+        /// <returns>An observable sequence that notifies observers about the asynchronous operation's result value and completion.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="progress"/> is null.</exception>
+        public static IObservable<TResult> ToObservable<TResult, TProgress>(this IAsyncOperationWithProgress<TResult, TProgress> source, IProgress<TProgress> progress)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (progress == null)
+            {
+                throw new ArgumentNullException(nameof(progress));
+            }
+
+            return source.ToObservable_(progress, false);
+        }
+
+        /// <summary>
+        /// Converts a Windows Runtime asynchronous operation to an observable sequence reporting its progress but ignoring its result value.
+        /// Each observer subscribed to the resulting observable sequence will be notified about the action's successful or exceptional completion.
+        /// </summary>
+        /// <typeparam name="TResult">The type of the asynchronous operation's result, which gets ignored by this conversion.</typeparam>
+        /// <typeparam name="TProgress">The type of the reported progress objects.</typeparam>
+        /// <param name="source">Asynchronous action to convert.</param>
+        /// <returns>An observable sequence that produces progress values from the asynchronous operation and notifies observers about the operations's completion.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        public static IObservable<TProgress> ToObservableProgress<TResult, TProgress>(this IAsyncOperationWithProgress<TResult, TProgress> source)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return Observable.Create<TProgress>(observer =>
+            {
+                var progress = observer.ToProgress();
+                var src = source.ToObservable_(progress, false);
+                return src.Subscribe(static _ => { }, observer.OnError, observer.OnCompleted);
+            });
+        }
+
+        /// <summary>
+        /// Converts a Windows Runtime asynchronous operation to an observable sequence by retrieving the operation's results whenever progress is reported and when the operation completes.
+        /// Each observer subscribed to the resulting observable sequence will be notified about the action's successful or exceptional completion.
+        /// </summary>
+        /// <typeparam name="TResult">The type of the asynchronous operation's result.</typeparam>
+        /// <typeparam name="TProgress">The type of the reported progress objects, which are used internally in the conversion but aren't exposed.</typeparam>
+        /// <param name="source">Asynchronous operation to convert.</param>
+        /// <returns>An observable sequence that notifies observers about the asynchronous operation's (incremental) result value(s) and completion.</returns>
+        /// <remarks>This conversion can be used with Windows Runtime APIs that support incremental retrieval of results during an asynchronous operation's execution.</remarks>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        public static IObservable<TResult> ToObservableMultiple<TResult, TProgress>(this IAsyncOperationWithProgress<TResult, TProgress> source)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return source.ToObservable_(null, true);
+        }
+
+        /// <summary>
+        /// Converts a Windows Runtime asynchronous operation to an observable sequence by retrieving the operation's results whenever progress is reported and when the operation completes. The operation's progress is reported through the supplied progress object.
+        /// Each observer subscribed to the resulting observable sequence will be notified about the action's successful or exceptional completion.
+        /// </summary>
+        /// <typeparam name="TResult">The type of the asynchronous operation's result.</typeparam>
+        /// <typeparam name="TProgress">The type of the reported progress objects.</typeparam>
+        /// <param name="source">Asynchronous operation to convert.</param>
+        /// <param name="progress">Progress object to receive progress notifications on.</param>
+        /// <returns>An observable sequence that notifies observers about the asynchronous operation's (incremental) result value(s) and completion.</returns>
+        /// <remarks>This conversion can be used with Windows Runtime APIs that support incremental retrieval of results during an asynchronous operation's execution.</remarks>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="progress"/> is null.</exception>
+        public static IObservable<TResult> ToObservableMultiple<TResult, TProgress>(this IAsyncOperationWithProgress<TResult, TProgress> source, IProgress<TProgress> progress)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (progress == null)
+            {
+                throw new ArgumentNullException(nameof(progress));
+            }
+
+            return source.ToObservable_(progress, true);
+        }
+
+        private static IObservable<TResult> ToObservable_<TResult, TProgress>(this IAsyncOperationWithProgress<TResult, TProgress> source, IProgress<TProgress>? progress, bool supportsMultiple)
+        {
+            return new AsyncInfoToObservableBridge<TResult, TProgress>(
+                source,
+                static (iai, a) => ((IAsyncOperationWithProgress<TResult, TProgress>)iai).Completed += new AsyncOperationWithProgressCompletedHandler<TResult, TProgress>((iao, status) => a(iao, status)),
+                iai => ((IAsyncOperationWithProgress<TResult, TProgress>)iai).GetResults(),
+                static (iai, a) => ((IAsyncOperationWithProgress<TResult, TProgress>)iai).Progress += new AsyncOperationProgressHandler<TResult, TProgress>((iap, p) => a(iap, p)),
+                progress,
+                supportsMultiple
+            );
+        }
+
+        #endregion
+    }
+}

+ 108 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/AsyncInfoToObservableBridge.cs

@@ -0,0 +1,108 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT License.
+// See the LICENSE file in the project root for more information. 
+
+using System.Reactive.Subjects;
+using Windows.Foundation;
+
+namespace System.Reactive.Integration.WindowsRuntime
+{
+    internal sealed class AsyncInfoToObservableBridge<TResult, TProgress> : ObservableBase<TResult>
+    {
+        private readonly Action<IAsyncInfo, Action<IAsyncInfo, AsyncStatus>> _onCompleted;
+        private readonly Func<IAsyncInfo, TResult> _getResult;
+        private readonly AsyncSubject<TResult> _subject;
+
+        public AsyncInfoToObservableBridge(IAsyncInfo info, Action<IAsyncInfo, Action<IAsyncInfo, AsyncStatus>> onCompleted, Func<IAsyncInfo, TResult> getResult, Action<IAsyncInfo, Action<IAsyncInfo, TProgress>>? onProgress, IProgress<TProgress>? progress, bool multiValue)
+        {
+            _onCompleted = onCompleted;
+            _getResult = getResult;
+
+            _subject = new AsyncSubject<TResult>();
+
+            onProgress?.Invoke(info, (iai, p) =>
+            {
+                if (multiValue && getResult != null)
+                {
+                    _subject.OnNext(getResult(iai));
+                }
+
+                progress?.Report(p);
+            });
+
+            Done(info, info.Status, true);
+        }
+
+        private void Done(IAsyncInfo info, AsyncStatus status, bool initial)
+        {
+            var error = default(Exception);
+            var result = default(TResult);
+
+            //
+            // Initial interactions with the IAsyncInfo object. Those could fail, which indicates
+            // a rogue implementation. Failure is just propagated out.
+            //
+            switch (status)
+            {
+                case AsyncStatus.Error:
+                    error = info.ErrorCode;
+                    if (error == null)
+                    {
+                        throw new InvalidOperationException("The asynchronous operation failed with a null error code.");
+                    }
+
+                    break;
+                case AsyncStatus.Canceled:
+                    error = new OperationCanceledException();
+                    break;
+                case AsyncStatus.Completed:
+                    if (_getResult != null)
+                    {
+                        result = _getResult(info);
+                    }
+
+                    break;
+                default:
+                    if (!initial)
+                    {
+                        throw new InvalidOperationException("The asynchronous operation completed unexpectedly.");
+                    }
+
+                    _onCompleted(info, (iai, s) => Done(iai, s, false));
+                    return;
+            }
+
+            //
+            // Close as early as possible, before running continuations which could fail. In case of
+            // failure above, we don't close out the object in order to allow for debugging of the
+            // rogue implementation without losing state prematurely. Notice _getResult is merely
+            // an indirect call to the appropriate GetResults method, which is not supposed to throw.
+            // Instead, an Error status should be returned.
+            //
+            info.Close();
+
+            //
+            // Now we run the continuations, which could take a long time. Failure here is catastrophic
+            // and under control of the upstream subscriber.
+            //
+            if (error != null)
+            {
+                _subject.OnError(error);
+            }
+            else
+            {
+                if (_getResult != null)
+                {
+                    _subject.OnNext(result!); // NB: Has been assigned in switch statement above.
+                }
+
+                _subject.OnCompleted();
+            }
+        }
+
+        protected override IDisposable SubscribeCore(IObserver<TResult> observer)
+        {
+            return _subject.Subscribe(observer);
+        }
+    }
+}

+ 266 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/CoreDispatcherScheduler.cs

@@ -0,0 +1,266 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT License.
+// See the LICENSE file in the project root for more information. 
+
+using System.Reactive.Disposables;
+using System.Reactive.Concurrency;
+using System.Runtime.ExceptionServices;
+using System.Threading;
+using Windows.System;
+using Windows.UI.Core;
+
+namespace System.Reactive.Integration.WindowsRuntime
+{
+    /// <summary>
+    /// Schedules units of work on a <see cref="CoreDispatcher"/>.
+    /// </summary>
+    /// <remarks>
+    /// This scheduler type is typically used indirectly through the extension methods defined by
+    /// <see cref="Linq.WindowsRuntimeCoreDispatcherObservable"/>.
+    /// </remarks>
+    [CLSCompliant(false)]
+    public sealed class CoreDispatcherScheduler : LocalScheduler, ISchedulerPeriodic
+    {
+        /// <summary>
+        /// Constructs a <see cref="CoreDispatcherScheduler"/> that schedules units of work on the given <see cref="CoreDispatcher"/>.
+        /// </summary>
+        /// <param name="dispatcher">Dispatcher to schedule work on.</param>
+        /// <exception cref="ArgumentNullException"><paramref name="dispatcher"/> is <c>null</c>.</exception>
+        public CoreDispatcherScheduler(CoreDispatcher dispatcher)
+        {
+            Dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
+            Priority = CoreDispatcherPriority.Normal;
+        }
+
+        /// <summary>
+        /// Constructs a <see cref="CoreDispatcherScheduler"/> that schedules units of work on the given <see cref="CoreDispatcher"/> with the given priority.
+        /// </summary>
+        /// <param name="dispatcher">Dispatcher to schedule work on.</param>
+        /// <param name="priority">Priority for scheduled units of work.</param>
+        /// <exception cref="ArgumentNullException"><paramref name="dispatcher"/> is <c>null</c>.</exception>
+        public CoreDispatcherScheduler(CoreDispatcher dispatcher, CoreDispatcherPriority priority)
+        {
+            Dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
+            Priority = priority;
+        }
+
+        /// <summary>
+        /// Gets the scheduler that schedules work on the <see cref="CoreDispatcher"/> associated with the current Window.
+        /// </summary>
+        public static CoreDispatcherScheduler Current
+        {
+            get
+            {
+                var window = CoreWindow.GetForCurrentThread()
+                    ?? throw new InvalidOperationException(Strings_WindowsThreading.NO_WINDOW_CURRENT);
+                return new CoreDispatcherScheduler(window.Dispatcher);
+            }
+        }
+
+        /// <summary>
+        /// Gets the <see cref="CoreDispatcher"/> associated with the <see cref="CoreDispatcherScheduler"/>.
+        /// </summary>
+        public CoreDispatcher Dispatcher { get; }
+
+        private DispatcherQueue? _dispatcherQueue;
+
+        /// <summary>
+        /// Gets the priority at which work is scheduled.
+        /// </summary>
+        public CoreDispatcherPriority Priority { get; }
+
+        /// <summary>
+        /// Schedules an action to be executed on the dispatcher.
+        /// </summary>
+        /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
+        /// <param name="state">State passed to the action to be executed.</param>
+        /// <param name="action">Action to be executed.</param>
+        /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="action"/> is <c>null</c>.</exception>
+        public override IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
+        {
+            if (action == null)
+            {
+                throw new ArgumentNullException(nameof(action));
+            }
+
+            var d = new SingleAssignmentDisposable();
+
+            var res = Dispatcher.RunAsync(Priority, () =>
+            {
+                if (!d.IsDisposed)
+                {
+                    try
+                    {
+                        d.Disposable = action(this, state);
+                    }
+                    catch (Exception ex)
+                    {
+                        //
+                        // Work-around for the behavior of throwing from RunAsync not propagating
+                        // the exception to the Application.UnhandledException event (as of W8RP)
+                        // as our users have come to expect from previous XAML stacks using Rx.
+                        //
+                        // If we wouldn't do this, there'd be an observable behavioral difference
+                        // between scheduling with TimeSpan.Zero or using this overload.
+                        //
+                        // For scheduler implementation guidance rules, see TaskPoolScheduler.cs
+                        // in System.Reactive.PlatformServices\Reactive\Concurrency.
+                        //
+                        
+                        var timer = CreateDispatcherQueue().CreateTimer();
+                        timer.Interval = TimeSpan.Zero;
+
+                        timer.Tick += (o, e) =>
+                        {
+                            timer.Stop();
+                            ExceptionDispatchInfo.Capture(ex).Throw();
+                        };
+
+                        timer.Start();
+                    }
+                }
+            });
+
+            return StableCompositeDisposable.Create(
+                d,
+                res.AsDisposable()
+            );
+        }
+
+        private DispatcherQueue CreateDispatcherQueue()
+        {
+            if(_dispatcherQueue != null)
+            {
+                return _dispatcherQueue;
+            }
+
+            if(Dispatcher.HasThreadAccess)
+            {
+                _dispatcherQueue = DispatcherQueue.GetForCurrentThread();
+                return _dispatcherQueue;
+            }
+
+            // We're on a different thread, get it from the right one
+            Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
+            {
+                _dispatcherQueue = DispatcherQueue.GetForCurrentThread();
+            }).GetAwaiter().GetResult(); // This is a synchronous call and we need the result to proceed
+
+            return _dispatcherQueue!;
+        }
+
+        /// <summary>
+        /// Schedules an action to be executed after <paramref name="dueTime"/> on the dispatcher, using a <see cref="DispatcherQueueTimer"/> object.
+        /// </summary>
+        /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
+        /// <param name="state">State passed to the action to be executed.</param>
+        /// <param name="action">Action to be executed.</param>
+        /// <param name="dueTime">Relative time after which to execute the action.</param>
+        /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="action"/> is <c>null</c>.</exception>
+        public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
+        {
+            if (action == null)
+            {
+                throw new ArgumentNullException(nameof(action));
+            }
+
+            var dt = Scheduler.Normalize(dueTime);
+            if (dt.Ticks == 0)
+            {
+                return Schedule(state, action);
+            }
+
+            return ScheduleSlow(state, dt, action);
+        }
+
+        private IDisposable ScheduleSlow<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
+        {
+            var d = new MultipleAssignmentDisposable();
+
+            var timer = CreateDispatcherQueue().CreateTimer();
+
+            timer.Tick += (o, e) =>
+            {
+                var t = Interlocked.Exchange(ref timer, null);
+                if (t != null)
+                {
+                    try
+                    {
+                        d.Disposable = action(this, state);
+                    }
+                    finally
+                    {
+                        t.Stop();
+                        action = static (s, t) => Disposable.Empty;
+                    }
+                }
+            };
+
+            timer.Interval = dueTime;
+            timer.Start();
+
+            d.Disposable = Disposable.Create(() =>
+            {
+                var t = Interlocked.Exchange(ref timer, null);
+                if (t != null)
+                {
+                    t.Stop();
+                    action = static (s, t) => Disposable.Empty;
+                }
+            });
+
+            return d;
+        }
+
+        /// <summary>
+        /// Schedules a periodic piece of work on the dispatcher, using a <see cref="DispatcherQueueTimer"/> object.
+        /// </summary>
+        /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
+        /// <param name="state">Initial state passed to the action upon the first iteration.</param>
+        /// <param name="period">Period for running the work periodically.</param>
+        /// <param name="action">Action to be executed, potentially updating the state.</param>
+        /// <returns>The disposable object used to cancel the scheduled recurring action (best effort).</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="action"/> is <c>null</c>.</exception>
+        /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than <see cref="TimeSpan.Zero"/>.</exception>
+        public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action)
+        {
+            //
+            // According to MSDN documentation, the default is TimeSpan.Zero, so that's definitely valid.
+            // Empirical observation - negative values seem to be normalized to TimeSpan.Zero, but let's not go there.
+            //
+            if (period < TimeSpan.Zero)
+            {
+                throw new ArgumentOutOfRangeException(nameof(period));
+            }
+
+            if (action == null)
+            {
+                throw new ArgumentNullException(nameof(action));
+            }
+
+            var timer = CreateDispatcherQueue().CreateTimer();
+
+            var state1 = state;
+
+            timer.Tick += (o, e) =>
+            {
+                state1 = action(state1);
+            };
+
+            timer.Interval = period;
+            timer.Start();
+
+            return Disposable.Create(() =>
+            {
+                var t = Interlocked.Exchange(ref timer, null);
+                if (t != null)
+                {
+                    t.Stop();
+                    action = static _ => _;
+                }
+            });
+        }
+    }
+}

+ 29 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/EventPatternSource.cs

@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT License.
+// See the LICENSE file in the project root for more information. 
+
+using Windows.Foundation;
+
+namespace System.Reactive.Integration.WindowsRuntime
+{
+    internal sealed class EventPatternSource<TSender, TEventArgs> : EventPatternSourceBase<TSender, TEventArgs>, ITypedEventPatternSource<TSender, TEventArgs>
+    {
+        public EventPatternSource(IObservable<EventPattern<TSender, TEventArgs>> source, Action<Action<TSender, TEventArgs>, /*object,*/ EventPattern<TSender, TEventArgs>> invokeHandler)
+            : base(source, invokeHandler)
+        {
+        }
+
+        event TypedEventHandler<TSender, TEventArgs> ITypedEventPatternSource<TSender, TEventArgs>.OnNext
+        {
+            add
+            {
+                Add(value, (o, e) => value(o!, e));
+            }
+
+            remove
+            {
+                Remove(value);
+            }
+        }
+    }
+}

+ 25 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/ITypedEventPatternSource.cs

@@ -0,0 +1,25 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT License.
+// See the LICENSE file in the project root for more information. 
+
+using Windows.Foundation;
+
+namespace System.Reactive.Integration.WindowsRuntime
+{
+    /// <summary>
+    /// Represents a data stream signaling its elements by means of a Windows Runtime
+    /// <see cref="TypedEventHandler{TSender, TResult}"/>.
+    /// </summary>
+    /// <typeparam name="TSender">Sender type.</typeparam>
+    /// <typeparam name="TEventArgs">Event arguments type.</typeparam>
+    [CLSCompliant(false)]
+    public interface ITypedEventPatternSource<TSender, TEventArgs>
+    {
+        /// <summary>
+        /// Event signaling the next element in the data stream.
+        /// </summary>
+#pragma warning disable CA1003 // (Use generic EventHandler.) The use of the Windows.Foundation handler type is by design
+        event TypedEventHandler<TSender, TEventArgs> OnNext;
+#pragma warning restore CA1003
+    }
+}

+ 65 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/StableCompositeDisposable.cs

@@ -0,0 +1,65 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT License.
+// See the LICENSE file in the project root for more information. 
+
+using System.Threading;
+
+namespace System.Reactive.Integration.WindowsRuntime
+{
+    /// <summary>
+    /// Represents a group of disposable resources that are disposed together.
+    /// </summary>
+    /// <remarks>
+    /// This is a copy from <c>System.Reactive</c> and then trimmed down to provide just the one
+    /// feature <see cref="System.Reactive.Linq.WindowsRuntimeAsyncInfoObservable"/>
+    /// needs: access to the internal CreateTrusted method. I didn't want to make that a
+    /// public-facing part of the main library. (And <c>InternalsVisibleTo</c> effectively makes it
+    /// somewhat public: it means changes to the internals could break this library.) Better, then
+    /// to copy over just the functionality required in this library. 
+    /// </remarks>
+    internal abstract class StableUncheckedCompositeDisposable : IDisposable
+    {
+        /// <summary>
+        /// Creates a group of disposable resources that are disposed together
+        /// and without copying or checking for nulls inside the group.
+        /// </summary>
+        /// <param name="disposables">The array of disposables that is trusted
+        /// to not contain nulls and gives no need to defensively copy it.</param>
+        /// <returns>Group of disposable resources that are disposed together.</returns>
+        internal static IDisposable CreateTrusted(params IDisposable[] disposables)
+        {
+            return new NAryTrustedArray(disposables);
+        }
+
+        /// <summary>
+        /// Disposes all disposables in the group.
+        /// </summary>
+        public abstract void Dispose();
+
+        /// <summary>
+        /// A stable composite that doesn't do defensive copy of
+        /// the input disposable array nor checks it for null.
+        /// </summary>
+        private sealed class NAryTrustedArray : StableUncheckedCompositeDisposable
+        {
+            private IDisposable[]? _disposables;
+
+            public NAryTrustedArray(IDisposable[] disposables)
+            {
+                Volatile.Write(ref _disposables, disposables);
+            }
+
+            public override void Dispose()
+            {
+                var old = Interlocked.Exchange(ref _disposables, null);
+                if (old != null)
+                {
+                    foreach (var d in old)
+                    {
+                        d.Dispose();
+                    }
+                }
+            }
+        }
+    }
+}

+ 81 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/Strings_WindowsThreading.Designer.cs

@@ -0,0 +1,81 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.42000
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace System.Reactive.Integration.WindowsRuntime {
+    using System;
+    
+    
+    /// <summary>
+    ///   A strongly-typed resource class, for looking up localized strings, etc.
+    /// </summary>
+    // This class was auto-generated by the StronglyTypedResourceBuilder
+    // class via a tool like ResGen or Visual Studio.
+    // To add or remove a member, edit your .ResX file then rerun ResGen
+    // with the /str option, or rebuild your VS project.
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Strings_WindowsThreading {
+        
+        private static global::System.Resources.ResourceManager resourceMan;
+        
+        private static global::System.Globalization.CultureInfo resourceCulture;
+        
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Strings_WindowsThreading() {
+        }
+        
+        /// <summary>
+        ///   Returns the cached ResourceManager instance used by this class.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Reactive.Integration.WindowsRuntime.Strings_WindowsThreading", typeof(Strings_WindowsThreading).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+        
+        /// <summary>
+        ///   Overrides the current thread's CurrentUICulture property for all
+        ///   resource lookups using this strongly typed resource class.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture {
+            get {
+                return resourceCulture;
+            }
+            set {
+                resourceCulture = value;
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Disposables collection can not contain null values..
+        /// </summary>
+        internal static string DISPOSABLES_CANT_CONTAIN_NULL {
+            get {
+                return ResourceManager.GetString("DISPOSABLES_CANT_CONTAIN_NULL", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to No current Window object found to obtain a CoreDispatcher from..
+        /// </summary>
+        internal static string NO_WINDOW_CURRENT {
+            get {
+                return ResourceManager.GetString("NO_WINDOW_CURRENT", resourceCulture);
+            }
+        }
+    }
+}

+ 126 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/Strings_WindowsThreading.resx

@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <data name="DISPOSABLES_CANT_CONTAIN_NULL" xml:space="preserve">
+    <value>Disposables collection can not contain null values.</value>
+  </data>
+  <data name="NO_WINDOW_CURRENT" xml:space="preserve">
+    <value>No current Window object found to obtain a CoreDispatcher from.</value>
+  </data>
+</root>

+ 44 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/System.Reactive.Integration.WindowsRuntime.csproj

@@ -0,0 +1,44 @@
+<Project Sdk="MSBuild.Sdk.Extras">
+
+  <PropertyGroup>
+    <!--
+    For .NET 6.0 and later, we need to specify the Windows 10 target framework because Windows
+    Runtime APIs are not available on older platforms. We use:
+    CoreDispatcher          10.0.10240
+    CoreDispatcherPriority  10.0.10240
+    CoreWindow              10.0.10240
+    DispatcherQueue         10.0.16299
+    DispatcherQueueTimer    10.0.16299
+
+    So in theory, 10.0.16299.0 meets our needs. However, the .NET SDK doesn't recognize that.
+    The oldest version it supports in a TFM is 10.0.17763.0, corresponding to Windows 1809.
+    Although that went out of mainstream support in 2021, it's still in extended support until 2029
+    for enterprises paying for long term support. It is also a common choice for the oldest version
+    supported by tooling (e.g., the .NET SDK), which is why we've chosen it here.
+    For UWP we need a newer version because Visual Studio 2022 supports nothing older than 18362.
+    -->
+    <TargetFrameworks>net6.0-windows10.0.17763.0;uap10.0.18362</TargetFrameworks>
+
+    <PackageTags>Rx;Reactive;Extensions;Observable;LINQ;Events;Windows Forms</PackageTags>
+    <Description>Reactive Extensions (Rx) for .NET</Description>
+
+    <PackageReadmeFile>readme.md</PackageReadmeFile>
+  </PropertyGroup>
+
+  <PropertyGroup>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Compile Include="..\AssemblyInfo.cs" Link="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\System.Reactive\System.Reactive.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Include="build\NuGet.Readme.md" Pack="true" PackagePath="\readme.md" />
+  </ItemGroup>
+
+</Project>

+ 230 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/System.Reactive.Linq/WindowsRuntimeAsyncInfoObservable.cs

@@ -0,0 +1,230 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT License.
+// See the LICENSE file in the project root for more information. 
+
+using System.Reactive.Integration.WindowsRuntime;
+using System.Reactive.Threading.Tasks;
+using System.Runtime.InteropServices.WindowsRuntime;
+using System.Threading.Tasks;
+using Windows.Foundation;
+
+namespace System.Reactive.Linq
+{
+    /// <summary>
+    /// Provides a set of extension methods to expose observable sequences as Windows Runtime
+    /// asynchronous actions and operations.
+    /// </summary>
+    [CLSCompliant(false)]
+    public static class WindowsRuntimeAsyncInfoObservable
+    {
+        #region IAsyncAction
+
+        /// <summary>
+        /// Creates a Windows Runtime asynchronous action that represents the completion of the observable sequence.
+        /// Upon cancellation of the asynchronous action, the subscription to the source sequence will be disposed.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence to expose as an asynchronous action.</param>
+        /// <returns>Windows Runtime asynchronous action object representing the completion of the observable sequence.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        public static IAsyncAction ToIAsyncAction<TSource>(this IObservable<TSource> source)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return AsyncInfo.Run(ct => (Task)source.DefaultIfEmpty().ToTask(ct));
+        }
+
+        #region Progress
+
+        /// <summary>
+        /// Creates a Windows Runtime asynchronous action that represents the completion of the observable sequence, reporting incremental progress for each element produced by the sequence.
+        /// Upon cancellation of the asynchronous action, the subscription to the source sequence will be disposed.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence to expose as an asynchronous action.</param>
+        /// <returns>Windows Runtime asynchronous action object representing the completion of the observable sequence, reporting incremental progress for each source sequence element.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        public static IAsyncActionWithProgress<int> ToIAsyncActionWithProgress<TSource>(this IObservable<TSource> source)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return AsyncInfo.Run<int>((ct, progress) =>
+            {
+                var i = 0;
+                return source.Do(_ => progress.Report(i++)).DefaultIfEmpty().ToTask(ct);
+            });
+        }
+
+        /// <summary>
+        /// Creates a Windows Runtime asynchronous action that represents the completion of the observable sequence, using a selector function to map the source sequence on a progress reporting sequence.
+        /// Upon cancellation of the asynchronous action, the subscription to the source sequence will be disposed.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <typeparam name="TProgress">The type of the elements in the progress sequence.</typeparam>
+        /// <param name="source">Source sequence to expose as an asynchronous action and to compute a progress sequence that gets reported through the asynchronous action.</param>
+        /// <param name="progressSelector">Selector function to map the source sequence on a progress reporting sequence.</param>
+        /// <returns>Windows Runtime asynchronous action object representing the completion of the result sequence, reporting progress computed through the progress sequence.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="progressSelector"/> is null.</exception>
+        public static IAsyncActionWithProgress<TProgress> ToIAsyncActionWithProgress<TSource, TProgress>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TProgress>> progressSelector)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (progressSelector == null)
+            {
+                throw new ArgumentNullException(nameof(progressSelector));
+            }
+
+            return AsyncInfo.Run<TProgress>((ct, progress) =>
+            {
+                return Observable.Create<TSource?>(observer =>
+                {
+                    var obs = Observer.Synchronize(observer);
+
+                    var data = source.Publish();
+
+                    var progressSubscription = progressSelector(data).Subscribe(progress.Report, obs.OnError);
+                    var dataSubscription = data.DefaultIfEmpty().Subscribe(obs);
+                    var connection = data.Connect();
+
+                    return StableUncheckedCompositeDisposable.CreateTrusted(progressSubscription, dataSubscription, connection);
+                }).ToTask(ct);
+            });
+        }
+
+        #endregion
+
+        #endregion
+
+        #region IAsyncOperation<T>
+
+        /// <summary>
+        /// Creates a Windows Runtime asynchronous operation that returns the last element of the observable sequence.
+        /// Upon cancellation of the asynchronous operation, the subscription to the source sequence will be disposed.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence to expose as an asynchronous operation.</param>
+        /// <returns>Windows Runtime asynchronous operation object that returns the last element of the observable sequence.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        public static IAsyncOperation<TSource> ToIAsyncOperation<TSource>(this IObservable<TSource> source)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return AsyncInfo.Run(ct => source.ToTask(ct));
+        }
+
+        /// <summary>
+        /// Creates a Windows Runtime asynchronous operation that returns the last element of the observable sequence, reporting incremental progress for each element produced by the sequence.
+        /// Upon cancellation of the asynchronous operation, the subscription to the source sequence will be disposed.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence to expose as an asynchronous operation.</param>
+        /// <returns>Windows Runtime asynchronous operation object that returns the last element of the observable sequence, reporting incremental progress for each source sequence element.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        public static IAsyncOperationWithProgress<TSource, int> ToIAsyncOperationWithProgress<TSource>(this IObservable<TSource> source)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return AsyncInfo.Run<TSource, int>((ct, progress) =>
+            {
+                var i = 0;
+                return source.Do(_ => progress.Report(i++)).ToTask(ct);
+            });
+        }
+
+        #region Progress
+
+        /// <summary>
+        /// Creates a Windows Runtime asynchronous operation that returns the last element of the result sequence, reporting incremental progress for each element produced by the source sequence.
+        /// Upon cancellation of the asynchronous operation, the subscription to the source sequence will be disposed.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
+        /// <param name="source">Source sequence to compute a result sequence that gets exposed as an asynchronous operation.</param>
+        /// <param name="resultSelector">Selector function to map the source sequence on a result sequence.</param>
+        /// <returns>Windows Runtime asynchronous operation object that returns the last element of the result sequence, reporting incremental progress for each source sequence element.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="resultSelector"/> is null.</exception>
+        public static IAsyncOperationWithProgress<TResult, int> ToIAsyncOperationWithProgress<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> resultSelector)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (resultSelector == null)
+            {
+                throw new ArgumentNullException(nameof(resultSelector));
+            }
+
+            return AsyncInfo.Run<TResult, int>((ct, progress) =>
+            {
+                var i = 0;
+                return resultSelector(source.Do(_ => progress.Report(i++))).ToTask(ct);
+            });
+        }
+
+        /// <summary>
+        /// Creates a Windows Runtime asynchronous operation that returns the last element of the result sequence, using a selector function to map the source sequence on a progress reporting sequence.
+        /// Upon cancellation of the asynchronous operation, the subscription to the source sequence will be disposed.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
+        /// <typeparam name="TProgress">The type of the elements in the progress sequence.</typeparam>
+        /// <param name="source">Source sequence to compute a result sequence that gets exposed as an asynchronous operation and a progress sequence that gets reported through the asynchronous operation.</param>
+        /// <param name="resultSelector">Selector function to map the source sequence on a result sequence.</param>
+        /// <param name="progressSelector">Selector function to map the source sequence on a progress reporting sequence.</param>
+        /// <returns>Windows Runtime asynchronous operation object that returns the last element of the result sequence, reporting progress computed through the progress sequence.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="resultSelector"/> or <paramref name="progressSelector"/> is null.</exception>
+        public static IAsyncOperationWithProgress<TResult, TProgress> ToIAsyncOperationWithProgress<TSource, TResult, TProgress>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> resultSelector, Func<IObservable<TSource>, IObservable<TProgress>> progressSelector)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (resultSelector == null)
+            {
+                throw new ArgumentNullException(nameof(resultSelector));
+            }
+
+            if (progressSelector == null)
+            {
+                throw new ArgumentNullException(nameof(progressSelector));
+            }
+
+            return AsyncInfo.Run<TResult, TProgress>((ct, progress) =>
+            {
+                return Observable.Create<TResult>(observer =>
+                {
+                    var obs = Observer.Synchronize(observer);
+
+                    var data = source.Publish();
+
+                    var progressSubscription = progressSelector(data).Subscribe(progress.Report, obs.OnError);
+                    var dataSubscription = resultSelector(data).Subscribe(obs);
+                    var connection = data.Connect();
+
+                    return StableUncheckedCompositeDisposable.CreateTrusted(progressSubscription, dataSubscription, connection);
+                }).ToTask(ct);
+            });
+        }
+
+        #endregion
+
+        #endregion
+    }
+}

+ 315 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/System.Reactive.Linq/WindowsRuntimeCoreDispatcherObservable.cs

@@ -0,0 +1,315 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT License.
+// See the LICENSE file in the project root for more information. 
+
+using Windows.UI.Core;
+
+#if HAS_OS_XAML
+using Windows.UI.Xaml;
+#endif
+
+using CoreDispatcherScheduler = System.Reactive.Integration.WindowsRuntime.CoreDispatcherScheduler;
+using Synchronization = System.Reactive.Concurrency.Synchronization;
+
+namespace System.Reactive.Linq
+{
+    /// <summary>
+    /// Provides a set of extension methods for scheduling actions performed through observable sequences on UI dispatchers.
+    /// </summary>
+    [CLSCompliant(false)]
+    public static class WindowsRuntimeCoreDispatcherObservable
+    {
+        #region ObserveOn[Current]CoreDispatcher
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its observer callbacks on the specified dispatcher.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="dispatcher">Dispatcher whose associated message loop is used to notify observers on.</param>
+        /// <returns>The source sequence whose observations happen on the specified dispatcher.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcher"/> is null.</exception>
+        public static IObservable<TSource> ObserveOnWindowsRuntimeCoreDispatcher<TSource>(this IObservable<TSource> source, CoreDispatcher dispatcher)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (dispatcher == null)
+            {
+                throw new ArgumentNullException(nameof(dispatcher));
+            }
+
+            return Synchronization.ObserveOn(source, new CoreDispatcherScheduler(dispatcher));
+        }
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its observer callbacks on the specified dispatcher.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="dispatcher">Dispatcher whose associated message loop is used to notify observers on.</param>
+        /// <param name="priority">Priority to schedule work items at.</param>
+        /// <returns>The source sequence whose observations happen on the specified dispatcher.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcher"/> is null.</exception>
+        public static IObservable<TSource> ObserveOnWindowsRuntimeCoreDispatcher<TSource>(this IObservable<TSource> source, CoreDispatcher dispatcher, CoreDispatcherPriority priority)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (dispatcher == null)
+            {
+                throw new ArgumentNullException(nameof(dispatcher));
+            }
+
+            return Synchronization.ObserveOn(source, new CoreDispatcherScheduler(dispatcher, priority));
+        }
+
+#if HAS_OS_XAML
+        /// <summary>
+        /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the specified object.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="dependencyObject">Object to get the dispatcher from.</param>
+        /// <returns>The source sequence whose observations happen on the specified object's dispatcher.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dependencyObject"/> is null.</exception>
+        public static IObservable<TSource> ObserveOnWindowsRuntimeCoreDispatcher<TSource>(this IObservable<TSource> source, DependencyObject dependencyObject)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (dependencyObject == null)
+            {
+                throw new ArgumentNullException(nameof(dependencyObject));
+            }
+
+            return Synchronization.ObserveOn(source, new CoreDispatcherScheduler(dependencyObject.Dispatcher));
+        }
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the specified object.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="dependencyObject">Object to get the dispatcher from.</param>
+        /// <param name="priority">Priority to schedule work items at.</param>
+        /// <returns>The source sequence whose observations happen on the specified object's dispatcher.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dependencyObject"/> is null.</exception>
+        public static IObservable<TSource> ObserveOnWindowsRuntimeCoreDispatcher<TSource>(this IObservable<TSource> source, DependencyObject dependencyObject, CoreDispatcherPriority priority)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (dependencyObject == null)
+            {
+                throw new ArgumentNullException(nameof(dependencyObject));
+            }
+
+            return Synchronization.ObserveOn(source, new CoreDispatcherScheduler(dependencyObject.Dispatcher, priority));
+        }
+#endif
+        /// <summary>
+        /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the current window.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <returns>The source sequence whose observations happen on the current window's dispatcher.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        public static IObservable<TSource> ObserveOnCurrentWindowsRuntimeCoreDispatcher<TSource>(this IObservable<TSource> source)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return Synchronization.ObserveOn(source, CoreDispatcherScheduler.Current);
+        }
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the current window.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="priority">Priority to schedule work items at.</param>
+        /// <returns>The source sequence whose observations happen on the current window's dispatcher.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        public static IObservable<TSource> ObserveOnCurrentWindowsRuntimeCoreDispatcher<TSource>(this IObservable<TSource> source, CoreDispatcherPriority priority)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return Synchronization.ObserveOn(source, new CoreDispatcherScheduler(CoreDispatcherScheduler.Current.Dispatcher, priority));
+        }
+
+        #endregion
+
+        #region SubscribeOn[CoreDispatcher]
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified dispatcher.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="dispatcher">Dispatcher whose associated message loop is used to perform subscription and unsubscription actions on.</param>
+        /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified dispatcher.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcher"/> is null.</exception>
+        /// <remarks>
+        /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the specified dispatcher.
+        /// In order to invoke observer callbacks on the specified dispatcher, e.g. to render results in a control, use <see cref="WindowsRuntimeCoreDispatcherObservable.ObserveOnWindowsRuntimeCoreDispatcher{TSource}(IObservable{TSource}, CoreDispatcher)"/>.
+        /// </remarks>
+        public static IObservable<TSource> SubscribeOnWindowsRuntimeCoreDispatcher<TSource>(this IObservable<TSource> source, CoreDispatcher dispatcher)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (dispatcher == null)
+            {
+                throw new ArgumentNullException(nameof(dispatcher));
+            }
+
+            return Synchronization.SubscribeOn(source, new CoreDispatcherScheduler(dispatcher));
+        }
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified dispatcher.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="dispatcher">Dispatcher whose associated message loop is used to perform subscription and unsubscription actions on.</param>
+        /// <param name="priority">Priority to schedule work items at.</param>
+        /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified dispatcher.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcher"/> is null.</exception>
+        /// <remarks>
+        /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the specified dispatcher.
+        /// In order to invoke observer callbacks on the specified dispatcher, e.g. to render results in a control, use <see cref="WindowsRuntimeCoreDispatcherObservable.ObserveOnWindowsRuntimeCoreDispatcher{TSource}(IObservable{TSource}, CoreDispatcher, CoreDispatcherPriority)"/>.
+        /// </remarks>
+        public static IObservable<TSource> SubscribeOnWindowsRuntimeCoreDispatcher<TSource>(this IObservable<TSource> source, CoreDispatcher dispatcher, CoreDispatcherPriority priority)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (dispatcher == null)
+            {
+                throw new ArgumentNullException(nameof(dispatcher));
+            }
+
+            return Synchronization.SubscribeOn(source, new CoreDispatcherScheduler(dispatcher, priority));
+        }
+
+#if HAS_OS_XAML
+        /// <summary>
+        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the specified object.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="dependencyObject">Object to get the dispatcher from.</param>
+        /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified object's dispatcher.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dependencyObject"/> is null.</exception>
+        /// <remarks>
+        /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the specified object.
+        /// In order to invoke observer callbacks on the dispatcher associated with the specified object, e.g. to render results in a control, use <see cref="WindowsRuntimeCoreDispatcherObservable.ObserveOnWindowsRuntimeCoreDispatcher{TSource}(IObservable{TSource}, DependencyObject)"/>.
+        /// </remarks>
+        public static IObservable<TSource> SubscribeOnWindowsRuntimeCoreDispatcher<TSource>(this IObservable<TSource> source, DependencyObject dependencyObject)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (dependencyObject == null)
+            {
+                throw new ArgumentNullException(nameof(dependencyObject));
+            }
+
+            return Synchronization.SubscribeOn(source, new CoreDispatcherScheduler(dependencyObject.Dispatcher));
+        }
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the specified object.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="dependencyObject">Object to get the dispatcher from.</param>
+        /// <param name="priority">Priority to schedule work items at.</param>
+        /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified object's dispatcher.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dependencyObject"/> is null.</exception>
+        /// <remarks>
+        /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the specified object.
+        /// In order to invoke observer callbacks on the dispatcher associated with the specified object, e.g. to render results in a control, use <see cref="WindowsRuntimeCoreDispatcherObservable.ObserveOnWindowsRuntimeCoreDispatcher{TSource}(IObservable{TSource}, DependencyObject, CoreDispatcherPriority)"/>.
+        /// </remarks>
+        public static IObservable<TSource> SubscribeOnWindowsRuntimeCoreDispatcher<TSource>(this IObservable<TSource> source, DependencyObject dependencyObject, CoreDispatcherPriority priority)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (dependencyObject == null)
+            {
+                throw new ArgumentNullException(nameof(dependencyObject));
+            }
+
+            return Synchronization.SubscribeOn(source, new CoreDispatcherScheduler(dependencyObject.Dispatcher, priority));
+        }
+#endif
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the current window.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the current window's dispatcher.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        /// <remarks>
+        /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the current window.
+        /// In order to invoke observer callbacks on the dispatcher associated with the current window, e.g. to render results in a control, use <see cref="WindowsRuntimeCoreDispatcherObservable.ObserveOnCurrentWindowsRuntimeCoreDispatcher{TSource}(IObservable{TSource})"/>.
+        /// </remarks>
+        public static IObservable<TSource> SubscribeOnCurrentWindowsRuntimeCoreDispatcher<TSource>(this IObservable<TSource> source)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return Synchronization.SubscribeOn(source, CoreDispatcherScheduler.Current);
+        }
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the current window.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="priority">Priority to schedule work items at.</param>
+        /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the current window's dispatcher.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        /// <remarks>
+        /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the current window.
+        /// In order to invoke observer callbacks on the dispatcher associated with the current window, e.g. to render results in a control, use <see cref="WindowsRuntimeCoreDispatcherObservable.ObserveOnCurrentWindowsRuntimeCoreDispatcher{TSource}(IObservable{TSource}, CoreDispatcherPriority)"/>.
+        /// </remarks>
+        public static IObservable<TSource> SubscribeOnCurrentWindowsRuntimeCoreDispatcher<TSource>(this IObservable<TSource> source, CoreDispatcherPriority priority)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return Synchronization.SubscribeOn(source, new CoreDispatcherScheduler(CoreDispatcherScheduler.Current.Dispatcher, priority));
+        }
+
+        #endregion
+    }
+}

+ 116 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/System.Reactive.Linq/WindowsRuntimeObservable.Events.cs

@@ -0,0 +1,116 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT License.
+// See the LICENSE file in the project root for more information. 
+
+using Windows.Foundation;
+
+namespace System.Reactive.Linq
+{
+    /// <summary>
+    /// Provides a set of static methods for importing typed events from Windows Runtime APIs.
+    /// </summary>
+    [CLSCompliant(false)]
+    public static partial class WindowsRuntimeObservable
+    {
+        /// <summary>
+        /// Converts a typed event, conforming to the standard event pattern, to an observable sequence.
+        /// </summary>
+        /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
+        /// <typeparam name="TResult">The type of the event data generated by the event.</typeparam>
+        /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
+        /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
+        /// <returns>The observable sequence that contains data representations of invocations of the underlying typed event.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="addHandler"/> or <paramref name="removeHandler"/> is null.</exception>
+        /// <seealso cref="ToWindowsFoundationEventPattern"/>
+        public static IObservable<EventPattern<TSender, TResult>> FromEventPattern<TSender, TResult>(Action<TypedEventHandler<TSender, TResult>> addHandler, Action<TypedEventHandler<TSender, TResult>> removeHandler)
+        {
+            if (addHandler == null)
+            {
+                throw new ArgumentNullException(nameof(addHandler));
+            }
+
+            if (removeHandler == null)
+            {
+                throw new ArgumentNullException(nameof(removeHandler));
+            }
+
+            return Observable.Create<EventPattern<TSender, TResult>>(observer =>
+            {
+                var h = new TypedEventHandler<TSender, TResult>((sender, args) =>
+                {
+                    observer.OnNext(new EventPattern<TSender, TResult>(sender, args));
+                });
+
+                addHandler(h);
+
+                return () =>
+                {
+                    removeHandler(h);
+                };
+            });
+        }
+
+        /// <summary>
+        /// Converts a typed event, conforming to the standard event pattern, to an observable sequence.
+        /// </summary>
+        /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
+        /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
+        /// <typeparam name="TResult">The type of the event data generated by the event.</typeparam>
+        /// <param name="conversion">A function used to convert the given event handler to a delegate compatible with the underlying typed event. The resulting delegate is used in calls to the addHandler and removeHandler action parameters.</param>
+        /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
+        /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
+        /// <returns>The observable sequence that contains data representations of invocations of the underlying typed event.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="conversion"/> or <paramref name="addHandler"/> or <paramref name="removeHandler"/> is null.</exception>
+        /// <seealso cref="ToWindowsFoundationEventPattern"/>
+        public static IObservable<EventPattern<TSender, TResult>> FromEventPattern<TDelegate, TSender, TResult>(Func<TypedEventHandler<TSender, TResult>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler)
+        {
+            if (conversion == null)
+            {
+                throw new ArgumentNullException(nameof(conversion));
+            }
+
+            if (addHandler == null)
+            {
+                throw new ArgumentNullException(nameof(addHandler));
+            }
+
+            if (removeHandler == null)
+            {
+                throw new ArgumentNullException(nameof(removeHandler));
+            }
+
+            return Observable.Create<EventPattern<TSender, TResult>>(observer =>
+            {
+                var h = conversion(new TypedEventHandler<TSender, TResult>((sender, args) =>
+                {
+                    observer.OnNext(new EventPattern<TSender, TResult>(sender, args));
+                }));
+
+                addHandler(h);
+
+                return () =>
+                {
+                    removeHandler(h);
+                };
+            });
+        }
+
+        /// <summary>
+        /// Exposes an observable sequence as an object with a typed event.
+        /// </summary>
+        /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
+        /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
+        /// <param name="source">Observable source sequence.</param>
+        /// <returns>The event source object.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        public static System.Reactive.Integration.WindowsRuntime.ITypedEventPatternSource<TSender, TEventArgs> ToWindowsFoundationEventPattern<TSender, TEventArgs>(this IObservable<EventPattern<TSender, TEventArgs>> source)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return new System.Reactive.Integration.WindowsRuntime.EventPatternSource<TSender, TEventArgs>(source, static (h, evt) => h(evt.Sender!, evt.EventArgs));
+        }
+    }
+}

+ 135 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/System.Reactive.Linq/WindowsRuntimeObservable.StandardSequenceOperators.cs

@@ -0,0 +1,135 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT License.
+// See the LICENSE file in the project root for more information. 
+
+using System.Reactive.Integration.WindowsRuntime;
+using Windows.Foundation;
+
+namespace System.Reactive.Linq
+{
+    public static partial class WindowsRuntimeObservable
+    {
+        /// <summary>
+        /// Projects each element of an observable sequence to a Windows Runtime asynchronous operation and merges all of the asynchronous operation results into one observable sequence.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <typeparam name="TResult">The type of the result produced by the projected asynchronous operations and the elements in the merged result sequence.</typeparam>
+        /// <param name="source">An observable sequence of elements to project.</param>
+        /// <param name="selector">A transform function to apply to each element.</param>
+        /// <returns>An observable sequence whose elements are the result of the asynchronous operations executed for each element of the input sequence.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
+        /// <remarks>
+        /// <para>
+        /// This overload supports composition of observable sequences and Windows Runtime
+        /// asynchronous operations, without requiring manual conversion of the asynchronous
+        /// operations to observable sequences using
+        /// <see cref="AsyncInfoObservableExtensions.ToObservable{TResult}(IAsyncOperation{TResult})"/>.
+        /// </para>
+        /// </remarks>
+        public static IObservable<TResult> SelectManyIAsyncOperation<TSource, TResult>(this IObservable<TSource> source, Func<TSource, IAsyncOperation<TResult>> selector)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (selector == null)
+            {
+                throw new ArgumentNullException(nameof(selector));
+            }
+
+            return source.SelectMany(x => selector(x).ToObservable());
+        }
+
+        /// <summary>
+        /// Projects each element of an observable sequence to a Windows Runtime asynchronous operation and merges all of the asynchronous operation results into one observable sequence.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <typeparam name="TResult">The type of the result produced by the projected asynchronous operations and the elements in the merged result sequence.</typeparam>
+        /// <typeparam name="TProgress">The type of the reported progress objects, which get ignored by this query operator.</typeparam>
+        /// <param name="source">An observable sequence of elements to project.</param>
+        /// <param name="selector">A transform function to apply to each element.</param>
+        /// <returns>An observable sequence whose elements are the result of the asynchronous operations executed for each element of the input sequence.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
+        /// <remarks>This overload supports composition of observable sequences and Windows Runtime asynchronous operations, without requiring manual conversion of the asynchronous operations to observable sequences using <see cref="AsyncInfoObservableExtensions.ToObservable{TResult}(IAsyncOperation{TResult})"/>.</remarks>
+        public static IObservable<TResult> SelectManyIAsyncOperationWithProgress<TSource, TResult, TProgress>(this IObservable<TSource> source, Func<TSource, IAsyncOperationWithProgress<TResult, TProgress>> selector)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (selector == null)
+            {
+                throw new ArgumentNullException(nameof(selector));
+            }
+
+            return source.SelectMany(x => selector(x).ToObservable());
+        }
+
+        /// <summary>
+        /// Projects each element of an observable sequence to a Windows Runtime asynchronous operation, invokes the result selector for the source element and the asynchronous operation result, and merges the results into one observable sequence.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <typeparam name="TAsyncOperationResult">The type of the results produced by the projected asynchronous operations.</typeparam>
+        /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate asynchronous operation results.</typeparam>
+        /// <param name="source">An observable sequence of elements to project.</param>
+        /// <param name="asyncOperationSelector">A transform function to apply to each element.</param>
+        /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
+        /// <returns>An observable sequence whose elements are the result of obtaining an asynchronous operation for each element of the input sequence and then mapping the asynchronous operation's result and its corresponding source element to a result element.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="asyncOperationSelector"/> or <paramref name="resultSelector"/> is null.</exception>
+        /// <remarks>This overload supports using LINQ query comprehension syntax in C# and Visual Basic to compose observable sequences and Windows Runtime asynchronous operations, without requiring manual conversion of the asynchronous operations to observable sequences using <see cref="AsyncInfoObservableExtensions.ToObservable{TResult}(IAsyncOperation{TResult})"/>.</remarks>
+        public static IObservable<TResult> SelectManyIAsyncOperation<TSource, TAsyncOperationResult, TResult>(this IObservable<TSource> source, Func<TSource, IAsyncOperation<TAsyncOperationResult>> asyncOperationSelector, Func<TSource, TAsyncOperationResult, TResult> resultSelector)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (asyncOperationSelector == null)
+            {
+                throw new ArgumentNullException(nameof(asyncOperationSelector));
+            }
+
+            if (resultSelector == null)
+            {
+                throw new ArgumentNullException(nameof(resultSelector));
+            }
+
+            return source.SelectMany(x => asyncOperationSelector(x).ToObservable(), resultSelector);
+        }
+
+        /// <summary>
+        /// Projects each element of an observable sequence to a Windows Runtime asynchronous operation, invokes the result selector for the source element and the asynchronous operation result, and merges the results into one observable sequence.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <typeparam name="TAsyncOperationResult">The type of the results produced by the projected asynchronous operations.</typeparam>
+        /// <typeparam name="TAsyncOperationProgress">The type of the reported progress objects, which get ignored by this query operator.</typeparam>
+        /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate asynchronous operation results.</typeparam>
+        /// <param name="source">An observable sequence of elements to project.</param>
+        /// <param name="asyncOperationSelector">A transform function to apply to each element.</param>
+        /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
+        /// <returns>An observable sequence whose elements are the result of obtaining an asynchronous operation for each element of the input sequence and then mapping the asynchronous operation's result and its corresponding source element to a result element.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="asyncOperationSelector"/> or <paramref name="resultSelector"/> is null.</exception>
+        /// <remarks>This overload supports using LINQ query comprehension syntax in C# and Visual Basic to compose observable sequences and Windows Runtime asynchronous operations, without requiring manual conversion of the asynchronous operations to observable sequences using <see cref="AsyncInfoObservableExtensions.ToObservable{TResult}(IAsyncOperation{TResult})"/>.</remarks>
+        public static IObservable<TResult> SelectManyIAsyncOperationWithProgress<TSource, TAsyncOperationResult, TAsyncOperationProgress, TResult>(this IObservable<TSource> source, Func<TSource, IAsyncOperationWithProgress<TAsyncOperationResult, TAsyncOperationProgress>> asyncOperationSelector, Func<TSource, TAsyncOperationResult, TResult> resultSelector)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (asyncOperationSelector == null)
+            {
+                throw new ArgumentNullException(nameof(asyncOperationSelector));
+            }
+
+            if (resultSelector == null)
+            {
+                throw new ArgumentNullException(nameof(resultSelector));
+            }
+
+            return source.SelectMany(x => asyncOperationSelector(x).ToObservable(), resultSelector);
+        }
+    }
+}

+ 30 - 0
Rx.NET/Source/src/System.Reactive.Integration.WindowsRuntime/build/NuGet.Readme.md

@@ -0,0 +1,30 @@
+# Windows Runtime Support for Rx.NET (Reactive Extensions for .NET)
+
+This library provides support for using some common Windows Runtime types from the Reactive Extensions for .NET (Rx.NET).
+
+See the main Rx.NET package at https://www.nuget.org/packages/System.Reactive for more information about Rx.NET.
+
+## Rx.NET and UI Frameworks
+
+Up as far as Rx.NET v6.0, UI framework support has been built directly into the main `System.Reactive` package.
+Unfortunately, this has caused problems since support for WPF and Windows Forms was added in .NET Core 3.1.
+Because .NET Core 3.1, and all subsequent versions of .NET have supported cross-platform use, WPF and Windows
+Forms are not universally available. Rx.NET used to make WPF and Windows Forms support if you targetted a
+sufficiently recent version of Windows in your application TFM. But this turns out to cause problems in
+some deployment models, adding as much as 90MB to the deployable size of an application.
+
+Consequently, starting in Rx.NET v7.0 we are moving all UI-framework-specific types, and also platform-specific
+types out into separate packages.
+
+## Features
+
+This package provides replacements for two deprecated types in `System.Reactive`:
+
+| Type in `System.Reactive` | Replacement | Purpose |
+|---|---|---|
+| `CoreDispatcherScheduler` (in `System.Reactive.Concurrency`) | `CoreDispatcherScheduler` (in `System.Reactive.Integration.WPF`) | Provides a scheduler that schedules work on the UI thread of applications using `CoreDispatcher` (e.g., UWP applications). |
+| `CoreDispatcherObservable` (in `System.Reactive.Linq`) | `WindowsRuntimeCoreDispatcherObservable` (in `System.Reactive.Linq`) | Provides a set of extension methods for scheduling work on the UI thread of an application using `CoreDispatcher` (e.g., UWP applications). WPF application. |
+| `WindowsObservable` (in `System.Reactive.Linq`) | `WindowsRuntimeObservable` (in `System.Reactive.Linq`) | Provides integration between `TypedEventHandler<TSender, TEventArgs` and `IObservable<T>`, and also `SelectMany` support for callbacks using the Windows Runtime asynchronous operation types (`IAsyncOperation` etc.) and `IObservable<T>`.
+| `AsyncInfoObservable` (in `System.Reactive.Linq`) | `WindowsRuntimeAsyncInfoObservable` (in `System.Reactive.Integration.WindowsRuntime`) | Provides conversions `IObservable<T>` top Windows Runtime asynchronous operation types (`IAsyncOperation` etc.). |
+| `AsyncInfoObservableExtensions` (in `System.Reactive.Windows.Foundation`) | `AsyncInfoObservableExtensions` (in `System.Reactive.Integration.WindowsRuntime` | Provides conversion from Windows Runtime asynchronous operation types (`IAsyncOperation` etc.) and `IObservable<T>`. 
+| `IEventPatternSource<TSender, TEventArgs>` (in `System.Reactive`) | `ITypedEventPatternSource<TSender, TEventArgs>` in `System.Reactive.Integration.WindowsRuntime` | Represents a source of events exposed as a Windows Runtime `TypedEventHandler<TSender, TEventArgs>`. |

+ 215 - 0
Rx.NET/Source/src/System.Reactive.Integration.Wpf/DispatcherScheduler.cs

@@ -0,0 +1,215 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT License.
+// See the LICENSE file in the project root for more information. 
+
+using System.Reactive.Disposables;
+using System.Reactive.Concurrency;
+using System.Threading;
+using System.Windows.Threading;
+
+namespace System.Reactive.Integration.Wpf
+{
+    /// <summary>
+    /// Represents an object that schedules units of work on a <see cref="System.Windows.Threading.Dispatcher"/>.
+    /// </summary>
+    /// <remarks>
+    /// <para>
+    /// This scheduler type is typically used indirectly through extension methods such as
+    /// <see cref="Linq.WpfDispatcherObservable.ObserveOnWpfDispatcher{TSource}(IObservable{TSource}, Dispatcher)"/> and
+    /// <see cref="Linq.WpfDispatcherObservable.SubscribeOnWpfDispatcher{TSource}(IObservable{TSource}, Dispatcher)"/>
+    /// in cases where you have a <see cref="Dispatcher"/> you want to use, or methods such as
+    /// <see cref="Linq.WpfDispatcherObservable.ObserveOnCurrentWpfDispatcher{TSource}(IObservable{TSource})"/>,
+    /// <see cref="Linq.WpfDispatcherObservable.ObserveOnCurrentWpfDispatcher{TSource}(IObservable{TSource})"/>
+    /// when you want to use the calling thread's Dispatcher.
+    /// </para>
+    /// </remarks>
+    public class DispatcherScheduler : LocalScheduler, ISchedulerPeriodic
+    {
+        /// <summary>
+        /// Gets the scheduler that schedules work on the <see cref="System.Windows.Threading.Dispatcher"/> for the current thread.
+        /// </summary>
+        public static DispatcherScheduler Current
+        {
+            get
+            {
+                var dispatcher = System.Windows.Threading.Dispatcher.FromThread(Thread.CurrentThread)
+                    ?? throw new InvalidOperationException(Strings_WindowsThreading.NO_DISPATCHER_CURRENT_THREAD);
+                return new DispatcherScheduler(dispatcher);
+            }
+        }
+
+        /// <summary>
+        /// Constructs a <see cref="DispatcherScheduler"/> that schedules units of work on the given <see cref="System.Windows.Threading.Dispatcher"/>.
+        /// </summary>
+        /// <param name="dispatcher"><see cref="DispatcherScheduler"/> to schedule work on.</param>
+        /// <exception cref="ArgumentNullException"><paramref name="dispatcher"/> is <c>null</c>.</exception>
+        public DispatcherScheduler(System.Windows.Threading.Dispatcher dispatcher)
+        {
+            Dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
+            Priority = System.Windows.Threading.DispatcherPriority.Normal;
+
+        }
+
+        /// <summary>
+        /// Constructs a <see cref="DispatcherScheduler"/> that schedules units of work on the given <see cref="System.Windows.Threading.Dispatcher"/> at the given priority.
+        /// </summary>
+        /// <param name="dispatcher"><see cref="DispatcherScheduler"/> to schedule work on.</param>
+        /// <param name="priority">Priority at which units of work are scheduled.</param>
+        /// <exception cref="ArgumentNullException"><paramref name="dispatcher"/> is <c>null</c>.</exception>
+        public DispatcherScheduler(System.Windows.Threading.Dispatcher dispatcher, System.Windows.Threading.DispatcherPriority priority)
+        {
+            Dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
+            Priority = priority;
+        }
+
+        /// <summary>
+        /// Gets the <see cref="System.Windows.Threading.Dispatcher"/> associated with the <see cref="DispatcherScheduler"/>.
+        /// </summary>
+        public System.Windows.Threading.Dispatcher Dispatcher { get; }
+
+        /// <summary>
+        /// Gets the priority at which work items will be dispatched.
+        /// </summary>
+        public System.Windows.Threading.DispatcherPriority Priority { get; }
+
+        /// <summary>
+        /// Schedules an action to be executed on the dispatcher.
+        /// </summary>
+        /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
+        /// <param name="state">State passed to the action to be executed.</param>
+        /// <param name="action">Action to be executed.</param>
+        /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="action"/> is <c>null</c>.</exception>
+        public override IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
+        {
+            if (action == null)
+            {
+                throw new ArgumentNullException(nameof(action));
+            }
+
+            var d = new SingleAssignmentDisposable();
+
+            Dispatcher.BeginInvoke(
+                new Action(() =>
+                {
+                    if (!d.IsDisposed)
+                    {
+                        d.Disposable = action(this, state);
+                    }
+                }),
+                Priority
+            );
+
+            return d;
+        }
+
+        /// <summary>
+        /// Schedules an action to be executed after <paramref name="dueTime"/> on the dispatcher, using a <see cref="System.Windows.Threading.DispatcherTimer"/> object.
+        /// </summary>
+        /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
+        /// <param name="state">State passed to the action to be executed.</param>
+        /// <param name="action">Action to be executed.</param>
+        /// <param name="dueTime">Relative time after which to execute the action.</param>
+        /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="action"/> is <c>null</c>.</exception>
+        public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
+        {
+            if (action == null)
+            {
+                throw new ArgumentNullException(nameof(action));
+            }
+
+            var dt = Scheduler.Normalize(dueTime);
+            if (dt.Ticks == 0)
+            {
+                return Schedule(state, action);
+            }
+
+            return ScheduleSlow(state, dt, action);
+        }
+
+        private IDisposable ScheduleSlow<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
+        {
+            var d = new MultipleAssignmentDisposable();
+
+            var timer = new System.Windows.Threading.DispatcherTimer(Priority, Dispatcher);
+
+            timer.Tick += (s, e) =>
+            {
+                var t = Interlocked.Exchange(ref timer, null);
+                if (t != null)
+                {
+                    try
+                    {
+                        d.Disposable = action(this, state);
+                    }
+                    finally
+                    {
+                        t.Stop();
+                        action = static (s, t) => Disposable.Empty;
+                    }
+                }
+            };
+
+            timer.Interval = dueTime;
+            timer.Start();
+
+            d.Disposable = Disposable.Create(() =>
+            {
+                var t = Interlocked.Exchange(ref timer, null);
+                if (t != null)
+                {
+                    t.Stop();
+                    action = static (s, t) => Disposable.Empty;
+                }
+            });
+
+            return d;
+        }
+
+        /// <summary>
+        /// Schedules a periodic piece of work on the dispatcher, using a <see cref="System.Windows.Threading.DispatcherTimer"/> object.
+        /// </summary>
+        /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
+        /// <param name="state">Initial state passed to the action upon the first iteration.</param>
+        /// <param name="period">Period for running the work periodically.</param>
+        /// <param name="action">Action to be executed, potentially updating the state.</param>
+        /// <returns>The disposable object used to cancel the scheduled recurring action (best effort).</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="action"/> is <c>null</c>.</exception>
+        /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than <see cref="TimeSpan.Zero"/>.</exception>
+        public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action)
+        {
+            if (period < TimeSpan.Zero)
+            {
+                throw new ArgumentOutOfRangeException(nameof(period));
+            }
+
+            if (action == null)
+            {
+                throw new ArgumentNullException(nameof(action));
+            }
+
+            var timer = new System.Windows.Threading.DispatcherTimer(Priority, Dispatcher);
+
+            var state1 = state;
+
+            timer.Tick += (s, e) =>
+            {
+                state1 = action(state1);
+            };
+
+            timer.Interval = period;
+            timer.Start();
+
+            return Disposable.Create(() =>
+            {
+                var t = Interlocked.Exchange(ref timer, null);
+                if (t != null)
+                {
+                    t.Stop();
+                    action = static _ => _;
+                }
+            });
+        }
+    }
+}

+ 72 - 0
Rx.NET/Source/src/System.Reactive.Integration.Wpf/Strings_WindowsThreading.Designer.cs

@@ -0,0 +1,72 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.42000
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace System.Reactive.Integration.Wpf {
+    using System;
+    
+    
+    /// <summary>
+    ///   A strongly-typed resource class, for looking up localized strings, etc.
+    /// </summary>
+    // This class was auto-generated by the StronglyTypedResourceBuilder
+    // class via a tool like ResGen or Visual Studio.
+    // To add or remove a member, edit your .ResX file then rerun ResGen
+    // with the /str option, or rebuild your VS project.
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Strings_WindowsThreading {
+        
+        private static global::System.Resources.ResourceManager resourceMan;
+        
+        private static global::System.Globalization.CultureInfo resourceCulture;
+        
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Strings_WindowsThreading() {
+        }
+        
+        /// <summary>
+        ///   Returns the cached ResourceManager instance used by this class.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Reactive.Integration.Wpf.Strings_WindowsThreading", typeof(Strings_WindowsThreading).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+        
+        /// <summary>
+        ///   Overrides the current thread's CurrentUICulture property for all
+        ///   resource lookups using this strongly typed resource class.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture {
+            get {
+                return resourceCulture;
+            }
+            set {
+                resourceCulture = value;
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to The current thread has no Dispatcher associated with it..
+        /// </summary>
+        internal static string NO_DISPATCHER_CURRENT_THREAD {
+            get {
+                return ResourceManager.GetString("NO_DISPATCHER_CURRENT_THREAD", resourceCulture);
+            }
+        }
+    }
+}

+ 123 - 0
Rx.NET/Source/src/System.Reactive.Integration.Wpf/Strings_WindowsThreading.resx

@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <data name="NO_DISPATCHER_CURRENT_THREAD" xml:space="preserve">
+    <value>The current thread has no Dispatcher associated with it.</value>
+  </data>
+</root>

+ 44 - 0
Rx.NET/Source/src/System.Reactive.Integration.Wpf/System.Reactive.Integration.Wpf.csproj

@@ -0,0 +1,44 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFrameworks>net472;net6.0-windows</TargetFrameworks>
+    <UseWPF>true</UseWPF>
+
+    <PackageTags>Rx;Reactive;Extensions;Observable;LINQ;Events;WPF</PackageTags>
+    <Description>Reactive Extensions (Rx) for .NET</Description>
+
+    <PackageReadmeFile>readme.md</PackageReadmeFile>
+  </PropertyGroup>
+
+  <PropertyGroup>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Compile Include="..\AssemblyInfo.cs" Link="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\System.Reactive\System.Reactive.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Compile Update="Strings_WindowsThreading.Designer.cs">
+      <DesignTime>True</DesignTime>
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Strings_WindowsThreading.resx</DependentUpon>
+    </Compile>
+  </ItemGroup>
+
+  <ItemGroup>
+    <EmbeddedResource Update="Strings_WindowsThreading.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Strings_WindowsThreading.Designer.cs</LastGenOutput>
+    </EmbeddedResource>
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Include="build\NuGet.Readme.md" Pack="true" PackagePath="\readme.md" />
+  </ItemGroup>
+
+</Project>

+ 498 - 0
Rx.NET/Source/src/System.Reactive.Integration.Wpf/System.Reactive.Linq/WpfDispatcherObservable.cs

@@ -0,0 +1,498 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT License.
+// See the LICENSE file in the project root for more information. 
+
+using System.Windows.Threading;
+
+using DispatcherScheduler = System.Reactive.Integration.Wpf.DispatcherScheduler;
+using Synchronization = System.Reactive.Concurrency.Synchronization;
+
+namespace System.Reactive.Linq
+{
+    /// <summary>
+    /// Provides a set of extension methods for scheduling actions performed through observable
+    /// sequences on UI dispatchers.
+    /// </summary>
+    /// <remarks>
+    /// <para>
+    /// This replaces the obsolete <c>System.Reactive.Linq.ControlObservable</c> class in
+    /// <c>System.Reactive</c>.
+    /// </para>
+    /// </remarks>
+    public static class WpfDispatcherObservable
+
+    {
+        #region ObserveOn[Current]Dispatcher
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its observer callbacks on the specified
+        /// dispatcher.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="dispatcher">Dispatcher whose associated message loop is used to notify observers on.</param>
+        /// <returns>The source sequence whose observations happen on the specified dispatcher.</returns>
+        /// <exception cref="ArgumentNullException">
+        /// <paramref name="source"/> or <paramref name="dispatcher"/> is null.
+        /// </exception>
+        public static IObservable<TSource> ObserveOnWpfDispatcher<TSource>(
+            this IObservable<TSource> source,
+            Dispatcher dispatcher)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (dispatcher == null)
+            {
+                throw new ArgumentNullException(nameof(dispatcher));
+            }
+
+            return ObserveOn_(source, dispatcher);
+        }
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its observer callbacks on the specified
+        /// dispatcher.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="dispatcher">Dispatcher whose associated message loop is used to notify observers on.</param>
+        /// <param name="priority">Priority to schedule work items at.</param>
+        /// <returns>The source sequence whose observations happen on the specified dispatcher.</returns>
+        /// <exception cref="ArgumentNullException">
+        /// <paramref name="source"/> or <paramref name="dispatcher"/> is null.
+        /// </exception>
+        public static IObservable<TSource> ObserveOnWpfDispatcher<TSource>(
+            this IObservable<TSource> source,
+            Dispatcher dispatcher,
+            DispatcherPriority priority)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (dispatcher == null)
+            {
+                throw new ArgumentNullException(nameof(dispatcher));
+            }
+
+            return ObserveOn_(source, dispatcher, priority);
+        }
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its observer callbacks on the specified
+        /// dispatcher scheduler.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="scheduler">Dispatcher scheduler to notify observers on.</param>
+        /// <returns>The source sequence whose observations happen on the specified dispatcher scheduler.</returns>
+        /// <exception cref="ArgumentNullException">
+        /// <paramref name="source"/> or <paramref name="scheduler"/> is null.
+        /// </exception>
+        public static IObservable<TSource> ObserveOn<TSource>(
+            this IObservable<TSource> source,
+            DispatcherScheduler scheduler)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (scheduler == null)
+            {
+                throw new ArgumentNullException(nameof(scheduler));
+            }
+
+            return ObserveOn_(source, scheduler.Dispatcher, scheduler.Priority);
+        }
+
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its observer callbacks on the dispatcher
+        /// associated with the specified object.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="dispatcherObject">Object to get the dispatcher from.</param>
+        /// <returns>The source sequence whose observations happen on the specified object's dispatcher.</returns>
+        /// <exception cref="ArgumentNullException">
+        /// <paramref name="source"/> or <paramref name="dispatcherObject"/> is null.
+        /// </exception>
+        public static IObservable<TSource> ObserveOnWpfDispatcher<TSource>(
+            this IObservable<TSource> source,
+            DispatcherObject dispatcherObject)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (dispatcherObject == null)
+            {
+                throw new ArgumentNullException(nameof(dispatcherObject));
+            }
+
+            return ObserveOn_(source, dispatcherObject.Dispatcher);
+        }
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its observer callbacks on the dispatcher
+        /// associated with the specified object.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="dispatcherObject">Object to get the dispatcher from.</param>
+        /// <param name="priority">Priority to schedule work items at.</param>
+        /// <returns>The source sequence whose observations happen on the specified object's dispatcher.</returns>
+        /// <exception cref="ArgumentNullException">
+        /// <paramref name="source"/> or <paramref name="dispatcherObject"/> is null.
+        /// </exception>
+        public static IObservable<TSource> ObserveOnWpfDispatcher<TSource>(
+            this IObservable<TSource> source,
+            DispatcherObject dispatcherObject,
+            DispatcherPriority priority)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (dispatcherObject == null)
+            {
+                throw new ArgumentNullException(nameof(dispatcherObject));
+            }
+
+            return ObserveOn_(source, dispatcherObject.Dispatcher, priority);
+        }
+
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its observer callbacks on the dispatcher
+        /// associated with the current thread.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <returns>The source sequence whose observations happen on the current thread's dispatcher.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        public static IObservable<TSource> ObserveOnCurrentWpfDispatcher<TSource>(
+            this IObservable<TSource> source)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return ObserveOn_(source, DispatcherScheduler.Current.Dispatcher);
+        }
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its observer callbacks on the dispatcher
+        /// associated with the current thread.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="priority">Priority to schedule work items at.</param>
+        /// <returns>The source sequence whose observations happen on the current thread's dispatcher.</returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        public static IObservable<TSource> ObserveOnCurrentWpfDispatcher<TSource>(
+            this IObservable<TSource> source,
+            DispatcherPriority priority)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return ObserveOn_(source, DispatcherScheduler.Current.Dispatcher, priority);
+        }
+
+        private static IObservable<TSource> ObserveOn_<TSource>(IObservable<TSource> source, Dispatcher dispatcher, DispatcherPriority priority)
+        {
+            return Synchronization.ObserveOn(source, new DispatcherSynchronizationContext(dispatcher, priority));
+        }
+
+
+        private static IObservable<TSource> ObserveOn_<TSource>(IObservable<TSource> source, Dispatcher dispatcher)
+        {
+            return Synchronization.ObserveOn(source, new DispatcherSynchronizationContext(dispatcher));
+        }
+
+        #endregion
+
+        #region SubscribeOn[Dispatcher]
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its subscription and unsubscription logic on
+        /// the specified dispatcher.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="dispatcher">
+        /// Dispatcher whose associated message loop is used to perform subscription and
+        /// unsubscription actions on.
+        /// </param>
+        /// <returns>
+        /// The source sequence whose subscriptions and unsubscriptions happen on the specified dispatcher.
+        /// </returns>
+        /// <exception cref="ArgumentNullException">
+        /// <paramref name="source"/> or <paramref name="dispatcher"/> is null.
+        /// </exception>
+        /// <remarks>
+        /// Only the side-effects of subscribing to the source sequence and disposing subscriptions
+        /// to the source sequence are run on the specified dispatcher. In order to invoke observer
+        /// callbacks on the specified dispatcher, e.g. to render results in a control, use
+        /// <see cref="ObserveOnWpfDispatcher{TSource}(IObservable{TSource}, Dispatcher)"/>.
+        /// </remarks>
+        public static IObservable<TSource> SubscribeOnWpfDispatcher<TSource>(
+            this IObservable<TSource> source,
+            Dispatcher dispatcher)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (dispatcher == null)
+            {
+                throw new ArgumentNullException(nameof(dispatcher));
+            }
+
+            return SubscribeOn_(source, dispatcher);
+        }
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its subscription and unsubscription logic on
+        /// the specified dispatcher.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="dispatcher">
+        /// Dispatcher whose associated message loop is used to to perform subscription and
+        /// unsubscription actions on.
+        /// </param>
+        /// <param name="priority">Priority to schedule work items at.</param>
+        /// <returns>
+        /// The source sequence whose subscriptions and unsubscriptions happen on the specified
+        /// dispatcher.
+        /// </returns>
+        /// <exception cref="ArgumentNullException">
+        /// <paramref name="source"/> or <paramref name="dispatcher"/> is null.
+        /// </exception>
+        /// <remarks>
+        /// Only the side-effects of subscribing to the source sequence and disposing subscriptions
+        /// to the source sequence are run on the specified dispatcher. In order to invoke observer
+        /// callbacks on the specified dispatcher, e.g. to render results in a control, use
+        /// <see cref="ObserveOnWpfDispatcher{TSource}(IObservable{TSource}, Dispatcher, DispatcherPriority)"/>.
+        /// </remarks>
+        public static IObservable<TSource> SubscribeOnWpfDispatcher<TSource>(
+            this IObservable<TSource> source,
+            Dispatcher dispatcher,
+            DispatcherPriority priority)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (dispatcher == null)
+            {
+                throw new ArgumentNullException(nameof(dispatcher));
+            }
+
+            return SubscribeOn_(source, dispatcher, priority);
+        }
+
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its subscription and unsubscription logic on
+        /// the specified dispatcher scheduler.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="scheduler">
+        /// Dispatcher scheduler to perform subscription and unsubscription actions on.
+        /// </param>
+        /// <returns>
+        /// The source sequence whose subscriptions and unsubscriptions happen on the specified
+        /// dispatcher scheduler.
+        /// </returns>
+        /// <exception cref="ArgumentNullException">
+        /// <paramref name="source"/> or <paramref name="scheduler"/> is null.
+        /// </exception>
+        /// <remarks>
+        /// Only the side-effects of subscribing to the source sequence and disposing subscriptions
+        /// to the source sequence are run on the specified scheduler. In order to invoke observer
+        /// callbacks on the specified scheduler, e.g. to render results in a control, use
+        /// <see cref="ObserveOn{TSource}(IObservable{TSource}, DispatcherScheduler)"/>.
+        /// </remarks>
+        public static IObservable<TSource> SubscribeOn<TSource>(
+            this IObservable<TSource> source,
+            DispatcherScheduler scheduler)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (scheduler == null)
+            {
+                throw new ArgumentNullException(nameof(scheduler));
+            }
+
+            return SubscribeOn_(source, scheduler.Dispatcher, scheduler.Priority);
+        }
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its subscription and unsubscription logic on
+        /// the dispatcher associated with the specified object.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="dispatcherObject">Object to get the dispatcher from.</param>
+        /// <returns>
+        /// The source sequence whose subscriptions and unsubscriptions happen on the specified
+        /// object's dispatcher.
+        /// </returns>
+        /// <exception cref="ArgumentNullException">
+        /// <paramref name="source"/> or <paramref name="dispatcherObject"/> is null.
+        /// </exception>
+        /// <remarks>
+        /// Only the side-effects of subscribing to the source sequence and disposing subscriptions
+        /// to the source sequence are run on the dispatcher associated with the specified object.
+        /// In order to invoke observer callbacks on the dispatcher associated with the specified
+        /// object, e.g. to render results in a control, use
+        /// <see cref="ObserveOnWpfDispatcher{TSource}(IObservable{TSource}, DispatcherObject)"/>.
+        /// </remarks>
+        public static IObservable<TSource> SubscribeOnWpfDispatcher<TSource>(
+            this IObservable<TSource> source,
+            DispatcherObject dispatcherObject)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (dispatcherObject == null)
+            {
+                throw new ArgumentNullException(nameof(dispatcherObject));
+            }
+
+            return SubscribeOn_(source, dispatcherObject.Dispatcher);
+        }
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its subscription and unsubscription logic on
+        /// the dispatcher associated with the specified object.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="dispatcherObject">Object to get the dispatcher from.</param>
+        /// <param name="priority">Priority to schedule work items at.</param>
+        /// <returns>
+        /// The source sequence whose subscriptions and unsubscriptions happen on the specified object's dispatcher.
+        /// </returns>
+        /// <exception cref="ArgumentNullException">
+        /// <paramref name="source"/> or <paramref name="dispatcherObject"/> is null.
+        /// </exception>
+        /// <remarks>
+        /// Only the side-effects of subscribing to the source sequence and disposing subscriptions
+        /// to the source sequence are run on the dispatcher associated with the specified object.
+        /// In order to invoke observer callbacks on the dispatcher associated with the specified
+        /// object, e.g. to render results in a control, use
+        /// <see cref="ObserveOnWpfDispatcher{TSource}(IObservable{TSource}, DispatcherObject, DispatcherPriority)"/>.
+        /// </remarks>
+        public static IObservable<TSource> SubscribeOnWpfDispatcher<TSource>(
+            this IObservable<TSource> source,
+            DispatcherObject dispatcherObject,
+            DispatcherPriority priority)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            if (dispatcherObject == null)
+            {
+                throw new ArgumentNullException(nameof(dispatcherObject));
+            }
+
+            return SubscribeOn_(source, dispatcherObject.Dispatcher, priority);
+        }
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its subscription and unsubscription logic on
+        /// the dispatcher associated with the current thread.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <returns>
+        /// The source sequence whose subscriptions and unsubscriptions happen on the current
+        /// thread's dispatcher.
+        /// </returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        /// <remarks>
+        /// Only the side-effects of subscribing to the source sequence and disposing subscriptions
+        /// to the source sequence are run on the dispatcher associated with the current thread.
+        /// In order to invoke observer callbacks on the dispatcher associated with the current
+        /// thread, e.g. to render results in a control, use
+        /// <see cref="ObserveOnCurrentWpfDispatcher{TSource}(IObservable{TSource})"/>.
+        /// </remarks>
+        public static IObservable<TSource> SubscribeOnCurrentWpfDispatcher<TSource>(
+            this IObservable<TSource> source)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return SubscribeOn_(source, DispatcherScheduler.Current.Dispatcher);
+        }
+
+        /// <summary>
+        /// Wraps the source sequence in order to run its subscription and unsubscription logic on
+        /// the dispatcher associated with the current thread.
+        /// </summary>
+        /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+        /// <param name="source">Source sequence.</param>
+        /// <param name="priority">Priority to schedule work items at.</param>
+        /// <returns>
+        /// The source sequence whose observations happen on the current thread's dispatcher.
+        /// </returns>
+        /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        /// <remarks>
+        /// Only the side-effects of subscribing to the source sequence and disposing subscriptions
+        /// to the source sequence are run on the dispatcher associated with the current thread.
+        /// In order to invoke observer callbacks on the dispatcher associated with the current
+        /// thread, e.g. to render results in a control, use
+        /// <see cref="ObserveOnCurrentWpfDispatcher{TSource}(IObservable{TSource}, DispatcherPriority)"/>.
+        /// </remarks>
+        public static IObservable<TSource> SubscribeOnCurrentWpfDispatcher<TSource>(
+            this IObservable<TSource> source,
+            DispatcherPriority priority)
+        {
+            if (source == null)
+            {
+                throw new ArgumentNullException(nameof(source));
+            }
+
+            return SubscribeOn_(source, DispatcherScheduler.Current.Dispatcher, priority);
+        }
+
+        private static IObservable<TSource> SubscribeOn_<TSource>(IObservable<TSource> source, Dispatcher dispatcher, DispatcherPriority priority)
+        {
+            return Synchronization.SubscribeOn(source, new DispatcherSynchronizationContext(dispatcher, priority));
+        }
+
+
+        private static IObservable<TSource> SubscribeOn_<TSource>(IObservable<TSource> source, Dispatcher dispatcher)
+        {
+            return Synchronization.SubscribeOn(source, new DispatcherSynchronizationContext(dispatcher));
+        }
+
+        #endregion
+    }
+}

+ 26 - 0
Rx.NET/Source/src/System.Reactive.Integration.Wpf/build/NuGet.Readme.md

@@ -0,0 +1,26 @@
+# WPF Support for Rx.NET (Reactive Extensions for .NET)
+
+This library provides WPF support for the Reactive Extensions for .NET (Rx.NET).
+
+See the main Rx.NET package at https://www.nuget.org/packages/System.Reactive for more information about Rx.NET.
+
+## Rx.NET and UI Frameworks
+
+Up as far as Rx.NET v6.0, UI framework support has been built directly into the main `System.Reactive` package.
+Unfortunately, this has caused problems since support for WPF and Windows Forms was added in .NET Core 3.1.
+Because .NET Core 3.1, and all subsequent versions of .NET have supported cross-platform use, WPF and Windows
+Forms are not universally available. Rx.NET used to make WPF and Windows Forms support if you targetted a
+sufficiently recent version of Windows in your application TFM. But this turns out to cause problems in
+some deployment models, adding as much as 90MB to the deployable size of an application.
+
+Consequently, starting in Rx.NET v7.0 we are moving all UI-framework-specific types, and also platform-specific
+types out into separate packages.
+
+## Features
+
+This package provides replacements for two deprecated types in `System.Reactive`:
+
+|Type in `System.Reactive` | Replacement | Purpose |
+|---|---|---|
+|`DispatcherScheduler` (in `System.Reactive.Concurrency`) | `DispatcherScheduler` (in `System.Reactive.Integration.WPF`) | Provides a scheduler that schedules work on the UI thread of a WPF application. |
+|`DispatcherObservable` (in `System.Reactive.Linq`) | `WindowsFormsControlObservable` (in `System.Reactive.Linq`) | Provides a set of extension methods for scheduling work on the UI thread of a WPF application. |

+ 1 - 1
Rx.NET/Source/src/System.Reactive/Concurrency/AsyncLock.cs

@@ -43,7 +43,7 @@ namespace System.Reactive.Concurrency
         /// <exception cref="ArgumentNullException"><paramref name="action"/> is <c>null</c>.</exception>
         /// <remarks>In case TState is a value type, this operation will involve boxing of <paramref name="state"/>.
         /// However, this is often an improvement over the allocation of a closure object and a delegate.</remarks>
-        internal void Wait<TState>(TState state, Action<TState> action)
+        public void Wait<TState>(TState state, Action<TState> action)
         {
             if (action == null)
             {

+ 30 - 1
Rx.NET/Source/src/System.Reactive/Concurrency/ThreadPoolScheduler.Windows.cs

@@ -15,11 +15,14 @@ namespace System.Reactive.Concurrency
     [CLSCompliant(false)]
     public sealed class ThreadPoolScheduler : LocalScheduler, ISchedulerPeriodic
     {
+#pragma warning disable CS0618 // Type or member is obsolete. The non-UWP ThreadPoolScheduler (which will eventually supersede this) defines the zero-args constructor as private, so it's only the accessibility of "public" that is obsolete, not the presence of the constructor. So this warning is spurious in this particular case.
         private static readonly Lazy<ThreadPoolScheduler> LazyDefault = new(static () => new ThreadPoolScheduler());
+#pragma warning restore CS0618
 
         /// <summary>
         /// Constructs a ThreadPoolScheduler that schedules units of work on the Windows ThreadPool.
         /// </summary>
+        [Obsolete("If you require the UWP-specific features of ThreadPoolScheduler use the UwpThreadPoolScheduler in the System.Reactive.Integration.Uwp package. Otherwise, use the Instance property, because this constructor will be removed in a future version (because UWP applications will end up with the same ThreadPoolScheduler as all other application types).")]
         public ThreadPoolScheduler()
         {
         }
@@ -28,6 +31,7 @@ namespace System.Reactive.Concurrency
         /// Constructs a ThreadPoolScheduler that schedules units of work on the Windows ThreadPool with the given priority.
         /// </summary>
         /// <param name="priority">Priority for scheduled units of work.</param>
+        [Obsolete("If you require the UWP-specific features of ThreadPoolScheduler use the UwpThreadPoolScheduler in the System.Reactive.Integration.Uwp package. Otherwise, use the Instance property, because this constructor will be removed in a future version (because UWP applications will end up with the same ThreadPoolScheduler as all other application types).")]
         public ThreadPoolScheduler(WorkItemPriority priority)
         {
             Priority = priority;
@@ -39,6 +43,7 @@ namespace System.Reactive.Concurrency
         /// </summary>
         /// <param name="priority">Priority for scheduled units of work.</param>
         /// <param name="options">Options that configure how work is scheduled.</param>
+        [Obsolete("If you require the UWP-specific features of ThreadPoolScheduler use the UwpThreadPoolScheduler in the System.Reactive.Integration.Uwp package. Otherwise, use the Instance property, because this constructor will be removed in a future version (because UWP applications will end up with the same ThreadPoolScheduler as all other application types).")]
         public ThreadPoolScheduler(WorkItemPriority priority, WorkItemOptions options)
         {
             Priority = priority;
@@ -60,11 +65,13 @@ namespace System.Reactive.Concurrency
         /// <summary>
         /// Gets the priority at which work is scheduled.
         /// </summary>
+        [Obsolete("If you require the UWP-specific features of ThreadPoolScheduler use the UwpThreadPoolScheduler in the System.Reactive.Integration.Uwp package. This property will be removed in a future version (because UWP applications will end up with the same ThreadPoolScheduler as all other application types).")]
         public WorkItemPriority Priority { get; }
 
         /// <summary>
         /// Gets the options that configure how work is scheduled.
         /// </summary>
+        [Obsolete("If you require the UWP-specific features of ThreadPoolScheduler use the UwpThreadPoolScheduler in the System.Reactive.Integration.Uwp package. This property will be removed in a future version (because UWP applications will end up with the same ThreadPoolScheduler as all other application types).")]
         public WorkItemOptions Options { get; }
 
         /// <summary>
@@ -81,11 +88,33 @@ namespace System.Reactive.Concurrency
                 throw new ArgumentNullException(nameof(action));
 
             var userWorkItem = new UserWorkItem<TState>(this, state, action);
-            
+
+#pragma warning disable CS0618 // Type or member is obsolete.
+            // A note on obsolescence:
+            //  The compiler complains because this uses Priority and Options. We could mark the
+            //  whole method as obsolete, but this would be slightly misleading because when we
+            // eventually remove the obsoleted UWP support, this whole ThreadPoolScheduler will
+            // be replaced by the non-UWP implementation, and that continues to support this
+            // Schedule overload. So the method isn't really obsolete - it will continue to be
+            // available to UWP apps even after we've removed all UWP-specific code from
+            // System.Reactive.
+            // An argument in favour of marking the method as Obsolete anyway is that the
+            // behaviour will change once we remove UWP code from System.Reactive. However,
+            // the change in behaviour is interesting only if you've specified either
+            // priority or options for the work items, and all the public methods we supply
+            // for that *are* obsolete. So anyone relying on that behaviour will already have
+            // received an obsolescence warning, and should move to UwpThreadPoolScheduler.
+            // Code that left these with the default values should not be affected by the
+            // change to the non-UWP ThreadPoolScheduler, so it would be irksome for them
+            // to get an obsolescence warning, particularly since there isn't actually
+            // anything they can do about it. If they want to continue using this type in
+            // the full knowledge that in a future version that means they'll get the
+            // non-UWP version, we want to let them.
             var res = ThreadPool.RunAsync(
                 iaa => userWorkItem.Run(),
                 Priority,
                 Options);
+#pragma warning restore CS0618 // Type or member is obsolete
 
             userWorkItem.CancelQueueDisposable = res.AsDisposable();
 

+ 4 - 4
Rx.NET/Source/src/System.Reactive/Notification.cs

@@ -7,8 +7,8 @@ using System.Diagnostics;
 using System.Globalization;
 using System.Reactive.Concurrency;
 
-#pragma warning disable 0659
-#pragma warning disable 0661
+#pragma warning disable CS0659
+#pragma warning disable CS0661
 
 namespace System.Reactive
 {
@@ -710,5 +710,5 @@ namespace System.Reactive
     }
 }
 
-#pragma warning restore 0659
-#pragma warning restore 0661
+#pragma warning restore CS0659
+#pragma warning restore CS0661

+ 10 - 1
Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Concurrency/ControlScheduler.cs

@@ -9,8 +9,17 @@ using System.Windows.Forms;
 namespace System.Reactive.Concurrency
 {
     /// <summary>
-    /// Represents an object that schedules units of work on the message loop associated with a Windows Forms control.
+    /// Obsolete. The <c>System.Reactive.Integration.WindowsForms</c> NuGet package defines a
+    /// <c>ControlScheduler</c> class in the <c>System.Reactive.Integration.WindowsForms</c>
+    /// namespace that replaces this class.
     /// </summary>
+    /// <remarks>
+    /// This will eventually be removed because all UI-framework-specific functionality is being
+    /// removed from <c>System.Reactive</c>. This is necessary to fix problems in which
+    /// <c>System.Reactive</c> causes applications to end up with dependencies on Windows Forms and
+    /// WPF whether they want them or not.
+    /// </remarks>
+    [Obsolete("Use System.Reactive.Integration.WindowsForms.ControlScheduler in the System.Reactive.Integration.WindowsForms package instead", error: false)]
     public class ControlScheduler : LocalScheduler, ISchedulerPeriodic
     {
         private readonly Control _control;

+ 8 - 2
Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Concurrency/DispatcherScheduler.cs

@@ -9,11 +9,17 @@ using System.Threading;
 namespace System.Reactive.Concurrency
 {
     /// <summary>
-    /// Represents an object that schedules units of work on a <see cref="System.Windows.Threading.Dispatcher"/>.
+    /// Obsolete. The <c>System.Reactive.Integration.Wpf</c> NuGet package defines a
+    /// <c>DispatcherScheduler</c> class in the <c>System.Reactive.Integration.Wpf</c>
+    /// namespace that replaces this class.
     /// </summary>
     /// <remarks>
-    /// This scheduler type is typically used indirectly through the <see cref="Linq.DispatcherObservable.ObserveOnDispatcher{TSource}(IObservable{TSource})"/> and <see cref="Linq.DispatcherObservable.SubscribeOnDispatcher{TSource}(IObservable{TSource})"/> methods that use the Dispatcher on the calling thread.
+    /// This will eventually be removed because all UI-framework-specific functionality is being
+    /// removed from <c>System.Reactive</c>. This is necessary to fix problems in which
+    /// <c>System.Reactive</c> causes applications to end up with dependencies on Windows Forms and
+    /// WPF whether they want them or not.
     /// </remarks>
+    [Obsolete("Use System.Reactive.Integration.Wpf.DispatcherScheduler in the System.Reactive.Integration.Wpf package instead", error: false)]
     public class DispatcherScheduler : LocalScheduler, ISchedulerPeriodic
     {
         /// <summary>

+ 46 - 3
Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/ControlObservable.cs

@@ -8,12 +8,51 @@ using System.Windows.Forms;
 namespace System.Reactive.Linq
 {
     /// <summary>
-    /// Provides a set of static methods for subscribing to IObservables using Windows Forms controls.
+    /// Obsolete. The <c>System.Reactive.Integration.WindowsForms</c> NuGet package defines a
+    /// <c>WindowsFormsControlObservable</c> class that defines new extension methods to be used in
+    /// place of these (also in the <c>System.Reactive.Linq</c> namespace).
     /// </summary>
+    /// <remarks>
+    /// <para>
+    /// The replacement <c>WindowsFormsControlObservable</c> class uses different names for extension
+    /// methods. When you migrate to that new class from this obsolete one, you will need to change
+    /// your code to invoke different method names:
+    /// </para>
+    /// <list type="table">
+    ///     <listheader><term>Rx &lt;= 6.0</term><term>Now</term></listheader>
+    ///     <item>
+    ///         <term><c>ObserveOn</c></term>
+    ///         <term><c>ObserveOnWindowsFormsControl</c></term>
+    ///     </item>
+    ///     <item>
+    ///         <term><c>SubscribeOn</c></term>
+    ///         <term><c>SubscribeOnWindowFormsControl</c></term>
+    ///     </item>
+    /// </list>
+    /// <para>
+    /// This will eventually be removed because all UI-framework-specific functionality is being
+    /// removed from <c>System.Reactive</c>. This is necessary to fix problems in which
+    /// <c>System.Reactive</c> causes applications to end up with dependencies on Windows Forms and
+    /// WPF whether they want them or not.
+    /// </para>
+    /// <para>
+    /// Rx defines extension methods for <see cref="IObservable{T}"/> in either the
+    /// <c>System.Reactive.Linq</c> or <c>System</c> namespaces. This means the replacement for
+    /// this obsolete class has to use different names. We need to retain these old obsolete
+    /// extension methods for many years to provide code using Rx with time to adapt, which means
+    /// the new extension methods must coexist with these old obsolete ones. Extension methods
+    /// are awkward to fully qualify, making it easier for migrating code if the new methods have
+    /// visibly different names (and not the same names on a new type).
+    /// </para>
+    /// </remarks>
+    [Obsolete("Use the extension methods defined by the System.Reactive.Linq.WindowsFormsControlObservable class in the System.Reactive.Integration.WindowsForms package instead", error: false)]
+
     public static class ControlObservable
     {
         /// <summary>
-        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the Windows Forms message loop associated with the specified control.
+        /// Obsolete. Use the <c>SubscribeOnWindowFormsControl</c> extension method defined by
+        /// <c>System.Reactive.Linq.WindowsFormsControlObservable</c> in the
+        /// <c>System.Reactive.Integration.WindowsForms</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
@@ -24,6 +63,7 @@ namespace System.Reactive.Linq
         /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the specified control.
         /// In order to invoke observer callbacks on the specified control, e.g. to render results in a control, use <see cref="ObserveOn"/>.
         /// </remarks>
+        [Obsolete("Use the SubscribeOnWindowFormsControl extension method defined by System.Reactive.Linq.WindowsFormsControlObservable in the System.Reactive.Integration.WindowsForms package instead", error: false)]
         public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, Control control)
         {
             if (source == null)
@@ -40,13 +80,16 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Wraps the source sequence in order to run its observer callbacks on the Windows Forms message loop associated with the specified control.
+        /// Obsolete. Use the <c>ObserveOnWindowsFormsControl</c> extension method defined by
+        /// <c>System.Reactive.Linq.WindowsFormsControlObservable</c> in the
+        /// <c>System.Reactive.Integration.WindowsForms</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
         /// <param name="control">Windows Forms control whose associated message loop is used to notify observers on.</param>
         /// <returns>The source sequence whose observations happen on the Windows Forms message loop associated with the specified control.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="control"/> is null.</exception>
+        [Obsolete("Use the ObserveOnWindowsFormsControl extension method defined by System.Reactive.Linq.WindowsFormsControlObservable in the System.Reactive.Integration.WindowsForms package instead", error: false)]
         public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, Control control)
         {
             if (source == null)

+ 107 - 18
Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/DispatcherObservable.cs

@@ -9,20 +9,73 @@ using System.Windows.Threading;
 namespace System.Reactive.Linq
 {
     /// <summary>
-    /// Provides a set of extension methods for scheduling actions performed through observable sequences on UI dispatchers.
+    /// Obsolete. The <c>System.Reactive.Integration.Wpf</c> NuGet package defines a
+    /// <c>WpfDispatcherObservable</c> class that defines new extension methods to be used in
+    /// place of these (also in the <c>System.Reactive.Linq</c> namespace).
     /// </summary>
+    /// <remarks>
+    /// <para>
+    /// The replacement <c>WpfDispatcherObservable</c> class uses different names for extension
+    /// methods. When you migrate to that new class from this obsolete one, you will need to change
+    /// your code to invoke different method names:
+    /// </para>
+    /// <list type="table">
+    ///     <listheader><term>Rx &lt;= 6.0</term><term>Now</term></listheader>
+    ///     <item>
+    ///         <term><c>ObserveOn</c> (except for overload taking a <c>DispatcherScheduler</c></term>
+    ///         <term><c>ObserveOnWpfDispatcher</c></term>
+    ///     </item>
+    ///     <item>
+    ///         <term><c>ObserveOnDispatcher</c></term>
+    ///         <term><c>ObserveOnCurrentWpfDispatcher</c></term>
+    ///     </item>
+    ///     <item>
+    ///         <term><c>SubscribeOn</c> (except for overload taking a <c>DispatcherScheduler</c></term>
+    ///         <term><c>SubscribeOnWpfDispatcher</c></term>
+    ///     </item>
+    ///     <item>
+    ///         <term><c>SubscribeOnDispatcher</c></term>
+    ///         <term><c>SubscribeOnCurrentWpfDispatcher</c></term>
+    ///     </item>
+    /// </list>
+    /// <para>
+    /// The overloads accepting a <see cref="DispatcherScheduler"/> don't need to be renamed because
+    /// there is no scope for ambiguity: if you pass the non-obsolete <see cref="DispatcherScheduler"/>
+    /// defined in this package, you will get the corresponding non-obsolete overload. (Code using
+    /// the old obsolete <c>DispatcherScheduler</c> will get the old obsolete overload.)
+    /// </para>
+    /// <para>
+    /// This will eventually be removed because all UI-framework-specific functionality is being
+    /// removed from <c>System.Reactive</c>. This is necessary to fix problems in which
+    /// <c>System.Reactive</c> causes applications to end up with dependencies on Windows Forms and
+    /// WPF whether they want them or not.
+    /// </para>
+    /// <para>
+    /// Rx defines extension methods for <see cref="IObservable{T}"/> in either the
+    /// <c>System.Reactive.Linq</c> or <c>System</c> namespaces. This means the replacement for
+    /// this obsolete class has to use different names. We need to retain these old obsolete
+    /// extension methods for many years to provide code using Rx with time to adapt, which means
+    /// the new extension methods must coexist with these old obsolete ones. Extension methods
+    /// are awkward to fully qualify, making it easier for migrating code if the new methods have
+    /// visibly different names (and not the same names on a new type).
+    /// </para>
+    /// </remarks>
+    [Obsolete("Use the extension methods defined by the System.Reactive.Linq.WpfDispatcherObservable class in the System.Reactive.Integration.Wpf package instead", error: false)]
     public static class DispatcherObservable
     {
         #region ObserveOn[Dispatcher]
 
         /// <summary>
-        /// Wraps the source sequence in order to run its observer callbacks on the specified dispatcher.
+        /// Obsolete. Use the <c>ObserveOnWpfDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WpfDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.Wpf</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
         /// <param name="dispatcher">Dispatcher whose associated message loop is used to notify observers on.</param>
         /// <returns>The source sequence whose observations happen on the specified dispatcher.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcher"/> is null.</exception>
+        [Obsolete("Use the ObserveOnWpfDispatcher extension method defined by System.Reactive.Linq.WpfDispatcherObservable in the System.Reactive.Integration.Wpf package instead", error: false)]
         public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, Dispatcher dispatcher)
         {
             if (source == null)
@@ -39,7 +92,9 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Wraps the source sequence in order to run its observer callbacks on the specified dispatcher.
+        /// Obsolete. Use the <c>ObserveOnWpfDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WpfDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.Wpf</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
@@ -47,6 +102,7 @@ namespace System.Reactive.Linq
         /// <param name="priority">Priority to schedule work items at.</param>
         /// <returns>The source sequence whose observations happen on the specified dispatcher.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcher"/> is null.</exception>
+        [Obsolete("Use the ObserveOnWpfDispatcher extension method defined by System.Reactive.Linq.WpfDispatcherObservable in the System.Reactive.Integration.Wpf package instead", error: false)]
         public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, Dispatcher dispatcher, DispatcherPriority priority)
         {
             if (source == null)
@@ -63,13 +119,16 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Wraps the source sequence in order to run its observer callbacks on the specified dispatcher scheduler.
+        /// Obsolete. Use the <c>ObserveOnWpfDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WpfDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.Wpf</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
         /// <param name="scheduler">Dispatcher scheduler to notify observers on.</param>
         /// <returns>The source sequence whose observations happen on the specified dispatcher scheduler.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
+        [Obsolete("Use the ObserveOnWpfDispatcher extension method defined by System.Reactive.Linq.WpfDispatcherObservable in the System.Reactive.Integration.Wpf package instead", error: false)]
         public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, DispatcherScheduler scheduler)
         {
             if (source == null)
@@ -85,15 +144,17 @@ namespace System.Reactive.Linq
             return ObserveOn_(source, scheduler.Dispatcher, scheduler.Priority);
         }
 
-
         /// <summary>
-        /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the specified object.
+        /// Obsolete. Use the <c>ObserveOnWpfDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WpfDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.Wpf</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
         /// <param name="dispatcherObject">Object to get the dispatcher from.</param>
         /// <returns>The source sequence whose observations happen on the specified object's dispatcher.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcherObject"/> is null.</exception>
+        [Obsolete("Use the ObserveOnWpfDispatcher extension method defined by System.Reactive.Linq.WpfDispatcherObservable in the System.Reactive.Integration.Wpf package instead", error: false)]
         public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, DispatcherObject dispatcherObject)
         {
             if (source == null)
@@ -110,7 +171,9 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the specified object.
+        /// Obsolete. Use the <c>ObserveOnWpfDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WpfDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.Wpf</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
@@ -118,6 +181,7 @@ namespace System.Reactive.Linq
         /// <param name="priority">Priority to schedule work items at.</param>
         /// <returns>The source sequence whose observations happen on the specified object's dispatcher.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcherObject"/> is null.</exception>
+        [Obsolete("Use the ObserveOnWpfDispatcher extension method defined by System.Reactive.Linq.WpfDispatcherObservable in the System.Reactive.Integration.Wpf package instead", error: false)]
         public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, DispatcherObject dispatcherObject, DispatcherPriority priority)
         {
             if (source == null)
@@ -133,14 +197,16 @@ namespace System.Reactive.Linq
             return ObserveOn_(source, dispatcherObject.Dispatcher, priority);
         }
 
-
         /// <summary>
-        /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the current thread.
+        /// Obsolete. Use the <c>ObserveOnCurrentWpfDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WpfDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.Wpf</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
         /// <returns>The source sequence whose observations happen on the current thread's dispatcher.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        [Obsolete("Use the ObserveOnCurrentWpfDispatcher extension method defined by System.Reactive.Linq.WpfDispatcherObservable in the System.Reactive.Integration.Wpf package instead", error: false)]
         public static IObservable<TSource> ObserveOnDispatcher<TSource>(this IObservable<TSource> source)
         {
             if (source == null)
@@ -152,13 +218,16 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the current thread.
+        /// Obsolete. Use the <c>ObserveOnCurrentWpfDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WpfDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.Wpf</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
         /// <param name="priority">Priority to schedule work items at.</param>
         /// <returns>The source sequence whose observations happen on the current thread's dispatcher.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        [Obsolete("Use the ObserveOnCurrentWpfDispatcher extension method defined by System.Reactive.Linq.WpfDispatcherObservable in the System.Reactive.Integration.Wpf package instead", error: false)]
         public static IObservable<TSource> ObserveOnDispatcher<TSource>(this IObservable<TSource> source, DispatcherPriority priority)
         {
             if (source == null)
@@ -185,7 +254,9 @@ namespace System.Reactive.Linq
         #region SubscribeOn[Dispatcher]
 
         /// <summary>
-        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified dispatcher.
+        /// Obsolete. Use the <c>SubscribeOnWpfDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WpfDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.Wpf</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
@@ -196,6 +267,7 @@ namespace System.Reactive.Linq
         /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the specified dispatcher.
         /// In order to invoke observer callbacks on the specified dispatcher, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, Dispatcher)"/>.
         /// </remarks>
+        [Obsolete("Use the SubscribeOnWpfDispatcher extension method defined by System.Reactive.Linq.WpfDispatcherObservable in the System.Reactive.Integration.Wpf package instead", error: false)]
         public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, Dispatcher dispatcher)
         {
             if (source == null)
@@ -212,7 +284,9 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified dispatcher.
+        /// Obsolete. Use the <c>SubscribeOnWpfDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WpfDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.Wpf</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
@@ -224,6 +298,7 @@ namespace System.Reactive.Linq
         /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the specified dispatcher.
         /// In order to invoke observer callbacks on the specified dispatcher, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, Dispatcher, DispatcherPriority)"/>.
         /// </remarks>
+        [Obsolete("Use the SubscribeOnWpfDispatcher extension method defined by System.Reactive.Linq.WpfDispatcherObservable in the System.Reactive.Integration.Wpf package instead", error: false)]
         public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, Dispatcher dispatcher, DispatcherPriority priority)
         {
             if (source == null)
@@ -239,9 +314,10 @@ namespace System.Reactive.Linq
             return SubscribeOn_(source, dispatcher, priority);
         }
 
-
         /// <summary>
-        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified dispatcher scheduler.
+        /// Obsolete. Use the <c>SubscribeOnWpfDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WpfDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.Wpf</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
@@ -252,6 +328,7 @@ namespace System.Reactive.Linq
         /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the specified scheduler.
         /// In order to invoke observer callbacks on the specified scheduler, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, DispatcherScheduler)"/>.
         /// </remarks>
+        [Obsolete("Use the SubscribeOnWpfDispatcher extension method defined by System.Reactive.Linq.WpfDispatcherObservable in the System.Reactive.Integration.Wpf package instead", error: false)]
         public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, DispatcherScheduler scheduler)
         {
             if (source == null)
@@ -268,7 +345,9 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the specified object.
+        /// Obsolete. Use the <c>SubscribeOnWpfDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WpfDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.Wpf</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
@@ -279,6 +358,7 @@ namespace System.Reactive.Linq
         /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the specified object.
         /// In order to invoke observer callbacks on the dispatcher associated with the specified object, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, DispatcherObject)"/>.
         /// </remarks>
+        [Obsolete("Use the SubscribeOnWpfDispatcher extension method defined by System.Reactive.Linq.WpfDispatcherObservable in the System.Reactive.Integration.Wpf package instead", error: false)]
         public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, DispatcherObject dispatcherObject)
         {
             if (source == null)
@@ -295,7 +375,9 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the specified object.
+        /// Obsolete. Use the <c>SubscribeOnWpfDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WpfDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.Wpf</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
@@ -307,6 +389,7 @@ namespace System.Reactive.Linq
         /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the specified object.
         /// In order to invoke observer callbacks on the dispatcher associated with the specified object, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, DispatcherObject, DispatcherPriority)"/>.
         /// </remarks>
+        [Obsolete("Use the SubscribeOnWpfDispatcher extension method defined by System.Reactive.Linq.WpfDispatcherObservable in the System.Reactive.Integration.Wpf package instead", error: false)]
         public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, DispatcherObject dispatcherObject, DispatcherPriority priority)
         {
             if (source == null)
@@ -323,7 +406,9 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the current thread.
+        /// Obsolete. Use the <c>SubscribeOnCurrentWpfDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WpfDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.Wpf</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
@@ -333,6 +418,7 @@ namespace System.Reactive.Linq
         /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the current thread.
         /// In order to invoke observer callbacks on the dispatcher associated with the current thread, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOnDispatcher{TSource}(IObservable{TSource})"/>.
         /// </remarks>
+        [Obsolete("Use the SubscribeOnCurrentWpfDispatcher extension method defined by System.Reactive.Linq.WpfDispatcherObservable in the System.Reactive.Integration.Wpf package instead", error: false)]
         public static IObservable<TSource> SubscribeOnDispatcher<TSource>(this IObservable<TSource> source)
         {
             if (source == null)
@@ -344,7 +430,9 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the current thread.
+        /// Obsolete. Use the <c>SubscribeOnCurrentWpfDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WpfDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.Wpf</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
@@ -355,6 +443,7 @@ namespace System.Reactive.Linq
         /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the current thread.
         /// In order to invoke observer callbacks on the dispatcher associated with the current thread, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOnDispatcher{TSource}(IObservable{TSource}, DispatcherPriority)"/>.
         /// </remarks>
+        [Obsolete("Use the SubscribeOnCurrentWpfDispatcher extension method defined by System.Reactive.Linq.WpfDispatcherObservable in the System.Reactive.Integration.Wpf package instead", error: false)]
         public static IObservable<TSource> SubscribeOnDispatcher<TSource>(this IObservable<TSource> source, DispatcherPriority priority)
         {
             if (source == null)

+ 8 - 5
Rx.NET/Source/src/System.Reactive/Platforms/UWP/Concurrency/CoreDispatcherScheduler.cs

@@ -8,18 +8,21 @@ using System.Runtime.ExceptionServices;
 using System.Threading;
 using Windows.System;
 using Windows.UI.Core;
-#if HAS_OS_XAML
-using Windows.UI.Xaml;
-#endif
 
 namespace System.Reactive.Concurrency
 {
     /// <summary>
-    /// Represents an object that schedules units of work on a <see cref="CoreDispatcher"/>.
+    /// Obsolete. The <c>System.Reactive.Integration.WindowsForms</c> NuGet package defines a
+    /// <c>ControlScheduler</c> class in the <c>System.Reactive.Integration.WindowsForms</c>
+    /// namespace that replaces this class.
     /// </summary>
     /// <remarks>
-    /// This scheduler type is typically used indirectly through the <see cref="Linq.CoreDispatcherObservable.ObserveOnCoreDispatcher{TSource}(IObservable{TSource})"/> and <see cref="Linq.CoreDispatcherObservable.SubscribeOnCoreDispatcher{TSource}(IObservable{TSource})"/> methods that use the current CoreDispatcher.
+    /// This will eventually be removed because all UI-framework-specific functionality is being
+    /// removed from <c>System.Reactive</c>. This is necessary to fix problems in which
+    /// <c>System.Reactive</c> causes applications to end up with dependencies on Windows Forms and
+    /// WPF whether they want them or not.
     /// </remarks>
+    [Obsolete("Use System.Reactive.Integration.WindowsRuntime.CoreDispatcherScheduler in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
     [CLSCompliant(false)]
     public sealed class CoreDispatcherScheduler : LocalScheduler, ISchedulerPeriodic
     {

+ 4 - 0
Rx.NET/Source/src/System.Reactive/Platforms/UWP/EventPatternSource.cs

@@ -7,6 +7,10 @@ using Windows.Foundation;
 
 namespace System.Reactive
 {
+    /// <summary>
+    /// Legacy implementation of obsolete <see cref="IEventPatternSource{TSender, TEventArgs}"/>
+    /// </summary>
+    [Obsolete]
     internal class EventPatternSource<TSender, TEventArgs> : EventPatternSourceBase<TSender, TEventArgs>, IEventPatternSource<TSender, TEventArgs>
     {
         public EventPatternSource(IObservable<EventPattern<TSender, TEventArgs>> source, Action<Action<TSender, TEventArgs>, /*object,*/ EventPattern<TSender, TEventArgs>> invokeHandler)

+ 12 - 1
Rx.NET/Source/src/System.Reactive/Platforms/UWP/Foundation/AsyncInfoExtensions.cs

@@ -9,9 +9,20 @@ using Windows.Foundation;
 namespace System.Reactive.Windows.Foundation
 {
     /// <summary>
-    /// Provides conversions from Windows Runtime asynchronous actions and operations to observable sequences.
+    /// Obsolete. Use the <c>AsyncInfoObservableExtensions</c> class in the
+    /// <c>System.Reactive.Integration.WindowsRuntime</c> namespace in the
+    /// <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
     /// </summary>
+    /// <remarks>
+    /// <para>
+    /// Since this obsolete class is the only public type in the <c>System.Reactive.Windows.Foundation</c>
+    /// namespace, existing code will normally need only to replace a using directive of
+    /// <c>using System.Reactive.Windows.Foundation;</c> with
+    /// <c>using System.Reactive.Integration.WindowsRuntime;</c>.
+    /// </para>
+    /// </remarks>
     [CLSCompliant(false)]
+    [Obsolete("Use the System.Reactive.Integration.WindowsRuntime.AsyncInfoObservableExtensions class in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
     public static class AsyncInfoObservableExtensions
     {
         #region IAsyncAction and IAsyncActionWithProgress

+ 9 - 0
Rx.NET/Source/src/System.Reactive/Platforms/UWP/Foundation/AsyncInfoToObservableBridge.cs

@@ -8,6 +8,15 @@ using Windows.Foundation;
 
 namespace System.Reactive.Windows.Foundation
 {
+    /// <summary>
+    /// Used only by the obsolete <see cref="AsyncInfoObservableExtensions"/> type.
+    /// </summary>
+    /// <typeparam name="TResult">The type of the asynchronous operation's result.</typeparam>
+    /// <typeparam name="TProgress">The type of the reported progress objects, which get ignored by this conversion.</typeparam>
+    /// <remarks>
+    /// This should be removed when <see cref="AsyncInfoObservableExtensions"/> is eventually removed.
+    /// </remarks>
+    [Obsolete]
     internal class AsyncInfoToObservableBridge<TResult, TProgress> : ObservableBase<TResult>
     {
         private readonly Action<IAsyncInfo, Action<IAsyncInfo, AsyncStatus>> _onCompleted;

+ 55 - 1
Rx.NET/Source/src/System.Reactive/Platforms/UWP/IEventPatternSource.cs

@@ -8,11 +8,65 @@ using Windows.Foundation;
 namespace System.Reactive
 {
     /// <summary>
-    /// Represents a data stream signaling its elements by means of an event.
+    /// Obsolete. The <c>System.Reactive.Integration.WindowsRuntime</c> NuGet package defines an
+    /// <c>ITypedEventPatternSource</c> class that should be used instead.
     /// </summary>
     /// <typeparam name="TSender">Sender type.</typeparam>
     /// <typeparam name="TEventArgs">Event arguments type.</typeparam>
+    /// <remarks>
+    /// <para>
+    /// This type is specific to Windows Runtime, because the <see cref="OnNext"/> member uses the
+    /// <see cref="TypedEventHandler{TSender, TResult}"/> type. This interface has therefore been
+    /// marked as Obsolete as part of a drive to remove all UI-framework-specific and platform-
+    /// specific types and members from the main <c>System.Reactive</c> package.
+    /// </para>
+    /// <para>
+    /// The replacement type is not just in a different package and namespace. Its name has been
+    /// changed. There are two reasons.
+    /// </para>
+    /// <para>
+    /// First, the choice of name and namespace implied, wrongly, that this was a general purpose
+    /// type like <see cref="IEventPattern{TSender, TEventArgs}"/> or
+    /// <see cref="IEventPatternSource{TEventArgs}"/>. It is not, because it can't exist in TFMs
+    /// where Windows Runtime is unavailable, such as <c>net8.0</c> or <c>netstandard2.0</c>. It
+    /// was especially confusing to give this the same name as the single-type-argument
+    /// <see cref="IEventPatternSource{TEventArgs}"/>, which has no such restriction. By differing
+    /// only in the number of type arguments, these types strongly implied that they were just
+    /// different forms of the same thing, when one was in fact only possible to use on certain
+    /// Windows targets.
+    /// </para>
+    /// <para>
+    /// Second, the fact that this was placed in the <c>System.Reactive</c> namespace means that
+    /// simply adding a replacement type with the same simple name in a different namespace is
+    /// likely to cause problems, because code may well have <c>System.Reactive</c> in scope for
+    /// other reasons. This could make it difficult for code to move cleanly onto the new
+    /// definition for as long as the old one remains present in <c>Obsolete</c> form, because it
+    /// might not always be possible to replace <c>using System.Reactive;</c> with, say,
+    /// <c>using System.Reactive.Integration.WindowsRuntime;</c>
+    /// </para>
+    /// <para>
+    /// The main reason for pushing such code out into separate packages is to avoid a problem in
+    /// which applications with a Windows-specific TFM end up acquiring dependencies on WPF and
+    /// Windows Forms when they take a dependency on <c>System.Reactive</c> regardless of whether
+    /// they are actually using those UI frameworks. In principle, we don't need to remove this
+    /// particular interface because <see cref="TypedEventHandler{TSender, TResult}"/> is not
+    /// technically specific to one framework. (It gets used in both UWP and WinUI. And since you
+    /// can use WinRT APIs in Windows Forms, WPF, and even Console applications, technically those
+    /// can use it too, although in most cases they wouldn't.) However, leaving Windows Runtime
+    /// APIs in the main <c>System.Reactive</c> component would mean we would still need to produce
+    /// both <c>netX.0</c> and <c>netX.0-windows10.0.YYYYY</c> TFMs even after we finally remove
+    /// all of the Obsolete types and members. People regularly get confused by the fact that in
+    /// the Rx v >=6.0 design, to get WPF or Windows Forms support today you need to use a suitably
+    /// recent Windows-specific TFM. If we retained that TFM but removed the UI framework support
+    /// from it leaving just the non-UI-framework-specific WinRT support) it seems likely that we
+    /// would cause even more confusion. So we want to get <c>System.Reactive</c> to a state where,
+    /// once we've removed all Obsolete types andmembers, we will need only non-OS-specific TFMs.
+    /// We are therefore moving all Windows Runtime/Foundation support out into a separate package
+    /// as well 
+    /// </para>
+    /// </remarks>
     [CLSCompliant(false)]
+    [Obsolete("Use the System.Reactive.Integration.WindowsRuntime.IEventPatternSource interface in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
     public interface IEventPatternSource<TSender, TEventArgs>
     {
         /// <summary>

+ 88 - 15
Rx.NET/Source/src/System.Reactive/Platforms/UWP/Linq/AsyncInfoObservable.cs

@@ -12,21 +12,88 @@ using Windows.Foundation;
 namespace System.Reactive.Linq
 {
     /// <summary>
-    /// Provides a set of extension methods to expose observable sequences as Windows Runtime asynchronous actions and operations.
+    /// Obsolete. The <c>System.Reactive.Integration.WindowsRuntime</c> NuGet package defines a
+    /// <c>WindowsRuntimeAsyncInfoObservable</c> class that defines new extension methods to be used in
+    /// place of these (also in the <c>System.Reactive.Linq</c> namespace).
     /// </summary>
+    /// <remarks>
+    /// <para>
+    /// The replacement <c>WindowsRuntimeAsyncInfoObservable</c> class uses different method names.
+    /// When you migrate to that new class from this obsolete one, you will need to change your code
+    /// to invoke different method names:
+    /// </para>
+    /// <list type="table">
+    ///     <listheader><term>Rx &lt;= 6.0</term><term>Now</term></listheader>
+    ///     <item>
+    ///         <term><c>ToAsyncAction</c></term>
+    ///         <term><c>ToIAsyncAction</c></term>
+    ///     </item>
+    ///     <item>
+    ///         <term><c>ToAsyncActionWithProgress</c></term>
+    ///         <term><c>ToIAsyncActionWithProgress</c></term>
+    ///     </item>
+    ///     <item>
+    ///         <term><c>ToAsyncOperation</c></term>
+    ///         <term><c>ToIAsyncOperation</c></term>
+    ///     </item>
+    ///     <item>
+    ///         <term><c>ToAsyncOperationWithProgress</c></term>
+    ///         <term><c>ToIAsyncOperationWithProgress</c></term>
+    ///     </item>
+    /// </list>
+    /// <para>
+    /// This name change is necessary because of a limitation of the <c>Obsolete</c> attribute: if
+    /// you want to move an existing method into a different package, and you leave the old one in
+    /// place (and marked as <c>Obsolete</c>) for a few versions to enable a gradual transition to
+    /// the new one, you will cause a problem if you keep the method name the same. The problem
+    /// is that both the old and new extension methods will be in scope simultaneously, so the
+    /// compiler will complain of ambiguity when you try to use them. In some cases you can
+    /// mitigate this by defining the new type in a different namespace, but the problem is that
+    /// these extension methods for <see cref="IObservable{T}"/> are defined in the
+    /// <c>System.Reactive.Linq</c> namespace. Code often brings that namespace into scope for more
+    /// than one reason, so we can't just tell developers to replace <c>using
+    /// System.Reactive.Linq;</c> with some other namespace. While that might fix the ambiguity
+    /// problem, it's likely to cause a load of new problems instead.
+    /// </para>
+    /// <para>
+    /// The only practical solution for this is for the new methods to have different names than
+    /// the old ones. (There is a proposal for being able to annotate a method as being for binary
+    /// compatibility only, but it will be some time before that is available to all projects using
+    /// Rx.NET.)
+    /// </para>
+    /// <para>
+    /// This type will eventually be removed because all UI-framework-specific functionality is
+    /// being removed from <c>System.Reactive</c>. This is necessary to fix problems in which
+    /// <c>System.Reactive</c> causes applications to end up with dependencies on Windows Forms and
+    /// WPF whether they want them or not. Strictly speaking, the <see cref="IAsyncAction"/>,
+    /// <see cref="IAsyncActionWithProgress{TProgress}"/>, <see cref="IAsyncOperation{TResult}"/>
+    /// and <see cref="IAsyncOperationWithProgress{TResult, TProgress}"/> types that this class
+    /// supports are part of Windows Runtime, and aren't specific to a single UI framework. These
+    /// types are used routinely in both UWP and WinUI applications, but it's also possible to use
+    /// them from Windows Forms, WPF, and even console applications. These types are effectively
+    /// WinRT native way of representing what the TPL's various Task types represent in a purely
+    /// .NET world. Even so, once support for genuinely UI-framework-specific types (such as
+    /// WPF's <c>Dispatcher</c>) has been removed from Rx.NET, support for these Windows Runtime
+    /// types would require us to continue to offer <c>netX.0</c> and <c>netX.0-windows10.0.YYYYY</c>
+    /// TFMs. The fact that we offer both has caused confusion because it's quite possible to get the
+    /// former even when running on Windows.
+    /// </para>
+    /// </remarks>
+    [Obsolete("Use the extension methods defined by the System.Reactive.Linq.WindowsRuntimeAsyncInfoObservable class in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
     [CLSCompliant(false)]
     public static class AsyncInfoObservable
     {
         #region IAsyncAction
 
         /// <summary>
-        /// Creates a Windows Runtime asynchronous action that represents the completion of the observable sequence.
-        /// Upon cancellation of the asynchronous action, the subscription to the source sequence will be disposed.
+        /// Obsolete. Use the <c>WindowsRuntimeAsyncInfoObservable.ToIAsyncAction</c> method in the
+        /// <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence to expose as an asynchronous action.</param>
         /// <returns>Windows Runtime asynchronous action object representing the completion of the observable sequence.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        [Obsolete("Use the ToIAsyncAction extension method defined by System.Reactive.Linq.WindowsRuntimeAsyncInfoObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IAsyncAction ToAsyncAction<TSource>(this IObservable<TSource> source)
         {
             if (source == null)
@@ -40,13 +107,14 @@ namespace System.Reactive.Linq
         #region Progress
 
         /// <summary>
-        /// Creates a Windows Runtime asynchronous action that represents the completion of the observable sequence, reporting incremental progress for each element produced by the sequence.
-        /// Upon cancellation of the asynchronous action, the subscription to the source sequence will be disposed.
+        /// Obsolete. Use the <c>WindowsRuntimeAsyncInfoObservable.ToIAsyncActionWithProgress</c>
+        /// method in the <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence to expose as an asynchronous action.</param>
         /// <returns>Windows Runtime asynchronous action object representing the completion of the observable sequence, reporting incremental progress for each source sequence element.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        [Obsolete("Use the ToIAsyncActionWithProgress extension method defined by System.Reactive.Linq.WindowsRuntimeAsyncInfoObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IAsyncActionWithProgress<int> ToAsyncActionWithProgress<TSource>(this IObservable<TSource> source)
         {
             if (source == null)
@@ -62,8 +130,8 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Creates a Windows Runtime asynchronous action that represents the completion of the observable sequence, using a selector function to map the source sequence on a progress reporting sequence.
-        /// Upon cancellation of the asynchronous action, the subscription to the source sequence will be disposed.
+        /// Obsolete. Use the <c>WindowsRuntimeAsyncInfoObservable.ToIAsyncActionWithProgress</c>
+        /// method in the <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <typeparam name="TProgress">The type of the elements in the progress sequence.</typeparam>
@@ -71,6 +139,7 @@ namespace System.Reactive.Linq
         /// <param name="progressSelector">Selector function to map the source sequence on a progress reporting sequence.</param>
         /// <returns>Windows Runtime asynchronous action object representing the completion of the result sequence, reporting progress computed through the progress sequence.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="progressSelector"/> is null.</exception>
+        [Obsolete("Use the ToIAsyncActionWithProgress extension method defined by System.Reactive.Linq.WindowsRuntimeAsyncInfoObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IAsyncActionWithProgress<TProgress> ToAsyncActionWithProgress<TSource, TProgress>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TProgress>> progressSelector)
         {
             if (source == null)
@@ -107,13 +176,14 @@ namespace System.Reactive.Linq
         #region IAsyncOperation<T>
 
         /// <summary>
-        /// Creates a Windows Runtime asynchronous operation that returns the last element of the observable sequence.
-        /// Upon cancellation of the asynchronous operation, the subscription to the source sequence will be disposed.
+        /// Obsolete. Use the <c>WindowsRuntimeAsyncInfoObservable.ToAsyncOperation</c> method in
+        /// the <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence to expose as an asynchronous operation.</param>
         /// <returns>Windows Runtime asynchronous operation object that returns the last element of the observable sequence.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        [Obsolete("Use the ToIAsyncOperation extension method defined by System.Reactive.Linq.WindowsRuntimeAsyncInfoObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IAsyncOperation<TSource> ToAsyncOperation<TSource>(this IObservable<TSource> source)
         {
             if (source == null)
@@ -125,13 +195,14 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Creates a Windows Runtime asynchronous operation that returns the last element of the observable sequence, reporting incremental progress for each element produced by the sequence.
-        /// Upon cancellation of the asynchronous operation, the subscription to the source sequence will be disposed.
+        /// Obsolete. Use the <c>WindowsRuntimeAsyncInfoObservable.ToIAsyncOperationWithProgress</c>
+        /// method in the <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence to expose as an asynchronous operation.</param>
         /// <returns>Windows Runtime asynchronous operation object that returns the last element of the observable sequence, reporting incremental progress for each source sequence element.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        [Obsolete("Use the ToIAsyncOperationWithProgress extension method defined by System.Reactive.Linq.WindowsRuntimeAsyncInfoObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IAsyncOperationWithProgress<TSource, int> ToAsyncOperationWithProgress<TSource>(this IObservable<TSource> source)
         {
             if (source == null)
@@ -149,8 +220,8 @@ namespace System.Reactive.Linq
         #region Progress
 
         /// <summary>
-        /// Creates a Windows Runtime asynchronous operation that returns the last element of the result sequence, reporting incremental progress for each element produced by the source sequence.
-        /// Upon cancellation of the asynchronous operation, the subscription to the source sequence will be disposed.
+        /// Obsolete. Use the <c>WindowsRuntimeAsyncInfoObservable.ToIAsyncOperationWithProgress</c>
+        /// method in the <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
@@ -158,6 +229,7 @@ namespace System.Reactive.Linq
         /// <param name="resultSelector">Selector function to map the source sequence on a result sequence.</param>
         /// <returns>Windows Runtime asynchronous operation object that returns the last element of the result sequence, reporting incremental progress for each source sequence element.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="resultSelector"/> is null.</exception>
+        [Obsolete("Use the ToIAsyncOperationWithProgress extension method defined by System.Reactive.Linq.WindowsRuntimeAsyncInfoObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IAsyncOperationWithProgress<TResult, int> ToAsyncOperationWithProgress<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> resultSelector)
         {
             if (source == null)
@@ -178,8 +250,8 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Creates a Windows Runtime asynchronous operation that returns the last element of the result sequence, using a selector function to map the source sequence on a progress reporting sequence.
-        /// Upon cancellation of the asynchronous operation, the subscription to the source sequence will be disposed.
+        /// Obsolete. Use the <c>WindowsRuntimeAsyncInfoObservable.ToIAsyncOperationWithProgress</c>
+        /// method in the <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
@@ -189,6 +261,7 @@ namespace System.Reactive.Linq
         /// <param name="progressSelector">Selector function to map the source sequence on a progress reporting sequence.</param>
         /// <returns>Windows Runtime asynchronous operation object that returns the last element of the result sequence, reporting progress computed through the progress sequence.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="resultSelector"/> or <paramref name="progressSelector"/> is null.</exception>
+        [Obsolete("Use the ToIAsyncOperationWithProgress extension method defined by System.Reactive.Linq.WindowsRuntimeAsyncInfoObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IAsyncOperationWithProgress<TResult, TProgress> ToAsyncOperationWithProgress<TSource, TResult, TProgress>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> resultSelector, Func<IObservable<TSource>, IObservable<TProgress>> progressSelector)
         {
             if (source == null)

+ 104 - 13
Rx.NET/Source/src/System.Reactive/Platforms/UWP/Linq/CoreDispatcherObservable.cs

@@ -13,21 +13,79 @@ using Windows.UI.Xaml;
 namespace System.Reactive.Linq
 {
     /// <summary>
-    /// Provides a set of extension methods for scheduling actions performed through observable sequences on UI dispatchers.
+    /// Obsolete. The <c>System.Reactive.Integration.WindowsRuntime</c> NuGet package defines a
+    /// <c>WindowsRuntimeCoreDispatcherObservable</c> class that defines new extension methods to
+    /// be used in place of these (also in the <c>System.Reactive.Linq</c> namespace).
     /// </summary>
+    /// <remarks>
+    /// <para>
+    /// The replacement <c>WindowsRuntimeCoreDispatcherObservable</c> class uses different names for extension
+    /// methods. When you migrate to that new class from this obsolete one, you will need to change
+    /// your code to invoke different method names:
+    /// </para>
+    /// <list type="table">
+    ///     <listheader><term>Rx &lt;= 6.0</term><term>Now</term></listheader>
+    ///     <item>
+    ///         <term><c>ObserveOn</c></term>
+    ///         <term><c>ObserveOnWindowsRuntimeCoreDispatcher</c></term>
+    ///     </item>
+    ///     <item>
+    ///         <term><c>ObserveOnCoreDispatcher</c></term>
+    ///         <term><c>ObserveOnCurrentWindowsRuntimeCoreDispatcher</c></term>
+    ///     </item>
+    ///     <item>
+    ///         <term><c>SubscribeOn</c></term>
+    ///         <term><c>SubscribeOnWindowsRuntimeCoreDispatcher</c></term>
+    ///     </item>
+    ///     <item>
+    ///         <term><c>SubscribeOnCoreDispatcher</c></term>
+    ///         <term><c>SubscribeOnCurrentWindowsRuntimeCoreDispatcher</c></term>
+    ///     </item>
+    /// </list>
+    /// <para>
+    /// The name changes are necessary because of a limitation of the <c>Obsolete</c> attribute: if
+    /// you want to move an existing extension method into a different package, and you leave the
+    /// old one in place (and marked as <c>Obsolete</c>) for a few versions to enable a gradual
+    /// transition to the new one, you will cause a problem if you keep the method name the same.
+    /// The problem is that both the old and new extension methods will be in scope simultaneously,
+    /// so the compiler will complain of ambiguity when you try to use them. In some cases you can
+    /// mitigate this by defining the new type in a different namespace, but the problem is that
+    /// these extension methods for <see cref="IObservable{T}"/> are defined in the
+    /// <c>System.Reactive.Linq</c> namespace. Code often brings that namespace into scope for more
+    /// than one reason, so we can't just tell developers to replace <c>using
+    /// System.Reactive.Linq;</c> with some other namespace. While that might fix the ambiguity
+    /// problem, it's likely to cause a load of new problems instead.
+    /// </para>
+    /// <para>
+    /// The only practical solution for this is for the new methods to have different names than
+    /// the old ones. (There is a proposal for being able to annotate a method as being for binary
+    /// compatibility only, but it will be some time before that is available to all projects using
+    /// Rx.NET.)
+    /// </para>
+    /// <para>
+    /// This type will eventually be removed because all UI-framework-specific functionality is
+    /// being removed from <c>System.Reactive</c>. This is necessary to fix problems in which
+    /// <c>System.Reactive</c> causes applications to end up with dependencies on Windows Forms and
+    /// WPF whether they want them or not.
+    /// </para>
+    /// </remarks>
     [CLSCompliant(false)]
+    [Obsolete("Use the extension methods defined by the System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable class in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
     public static class CoreDispatcherObservable
     {
         #region ObserveOn[CoreDispatcher]
 
         /// <summary>
-        /// Wraps the source sequence in order to run its observer callbacks on the specified dispatcher.
+        /// Obsolete. Use the <c>ObserveOnWindowsRuntimeCoreDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
         /// <param name="dispatcher">Dispatcher whose associated message loop is used to notify observers on.</param>
         /// <returns>The source sequence whose observations happen on the specified dispatcher.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcher"/> is null.</exception>
+        [Obsolete("Use the ObserveOnWindowsRuntimeCoreDispatcher extension method defined by System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, CoreDispatcher dispatcher)
         {
             if (source == null)
@@ -44,7 +102,9 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Wraps the source sequence in order to run its observer callbacks on the specified dispatcher.
+        /// Obsolete. Use the <c>ObserveOnWindowsRuntimeCoreDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
@@ -52,6 +112,7 @@ namespace System.Reactive.Linq
         /// <param name="priority">Priority to schedule work items at.</param>
         /// <returns>The source sequence whose observations happen on the specified dispatcher.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcher"/> is null.</exception>
+        [Obsolete("Use the ObserveOnWindowsRuntimeCoreDispatcher extension method defined by System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, CoreDispatcher dispatcher, CoreDispatcherPriority priority)
         {
             if (source == null)
@@ -69,13 +130,16 @@ namespace System.Reactive.Linq
 
 #if HAS_OS_XAML
         /// <summary>
-        /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the specified object.
+        /// Obsolete. Use the <c>ObserveOnWindowsRuntimeCoreDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
         /// <param name="dependencyObject">Object to get the dispatcher from.</param>
         /// <returns>The source sequence whose observations happen on the specified object's dispatcher.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dependencyObject"/> is null.</exception>
+        [Obsolete("Use the ObserveOnWindowsRuntimeCoreDispatcher extension method defined by System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, DependencyObject dependencyObject)
         {
             if (source == null)
@@ -92,7 +156,9 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the specified object.
+        /// Obsolete. Use the <c>ObserveOnWindowsRuntimeCoreDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
@@ -100,6 +166,7 @@ namespace System.Reactive.Linq
         /// <param name="priority">Priority to schedule work items at.</param>
         /// <returns>The source sequence whose observations happen on the specified object's dispatcher.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dependencyObject"/> is null.</exception>
+        [Obsolete("Use the ObserveOnWindowsRuntimeCoreDispatcher extension method defined by System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, DependencyObject dependencyObject, CoreDispatcherPriority priority)
         {
             if (source == null)
@@ -116,12 +183,15 @@ namespace System.Reactive.Linq
         }
 #endif
         /// <summary>
-        /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the current window.
+        /// Obsolete. Use the <c>ObserveOnCurrentWindowsRuntimeCoreDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
         /// <returns>The source sequence whose observations happen on the current window's dispatcher.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        [Obsolete("Use the ObserveOnCurrentWindowsRuntimeCoreDispatcher extension method defined by System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IObservable<TSource> ObserveOnCoreDispatcher<TSource>(this IObservable<TSource> source)
         {
             if (source == null)
@@ -133,13 +203,16 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the current window.
+        /// Obsolete. Use the <c>ObserveOnCurrentWindowsRuntimeCoreDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
         /// <param name="priority">Priority to schedule work items at.</param>
         /// <returns>The source sequence whose observations happen on the current window's dispatcher.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        [Obsolete("Use the ObserveOnCurrentWindowsRuntimeCoreDispatcher extension method defined by System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IObservable<TSource> ObserveOnDispatcher<TSource>(this IObservable<TSource> source, CoreDispatcherPriority priority)
         {
             if (source == null)
@@ -155,7 +228,9 @@ namespace System.Reactive.Linq
         #region SubscribeOn[CoreDispatcher]
 
         /// <summary>
-        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified dispatcher.
+        /// Obsolete. Use the <c>SubscribeOnWindowsRuntimeCoreDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
@@ -166,6 +241,7 @@ namespace System.Reactive.Linq
         /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the specified dispatcher.
         /// In order to invoke observer callbacks on the specified dispatcher, e.g. to render results in a control, use <see cref="CoreDispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, CoreDispatcher)"/>.
         /// </remarks>
+        [Obsolete("Use the SubscribeOnWindowsRuntimeCoreDispatcher extension method defined by System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, CoreDispatcher dispatcher)
         {
             if (source == null)
@@ -182,7 +258,9 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified dispatcher.
+        /// Obsolete. Use the <c>SubscribeOnWindowsRuntimeCoreDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
@@ -194,6 +272,7 @@ namespace System.Reactive.Linq
         /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the specified dispatcher.
         /// In order to invoke observer callbacks on the specified dispatcher, e.g. to render results in a control, use <see cref="CoreDispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, CoreDispatcher, CoreDispatcherPriority)"/>.
         /// </remarks>
+        [Obsolete("Use the SubscribeOnWindowsRuntimeCoreDispatcher extension method defined by System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, CoreDispatcher dispatcher, CoreDispatcherPriority priority)
         {
             if (source == null)
@@ -211,7 +290,9 @@ namespace System.Reactive.Linq
 
 #if HAS_OS_XAML
         /// <summary>
-        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the specified object.
+        /// Obsolete. Use the <c>SubscribeOnWindowsRuntimeCoreDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
@@ -222,6 +303,7 @@ namespace System.Reactive.Linq
         /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the specified object.
         /// In order to invoke observer callbacks on the dispatcher associated with the specified object, e.g. to render results in a control, use <see cref="CoreDispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, DependencyObject)"/>.
         /// </remarks>
+        [Obsolete("Use the SubscribeOnWindowsRuntimeCoreDispatcher extension method defined by System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, DependencyObject dependencyObject)
         {
             if (source == null)
@@ -238,7 +320,9 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the specified object.
+        /// Obsolete. Use the <c>SubscribeOnWindowsRuntimeCoreDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
@@ -250,6 +334,7 @@ namespace System.Reactive.Linq
         /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the specified object.
         /// In order to invoke observer callbacks on the dispatcher associated with the specified object, e.g. to render results in a control, use <see cref="CoreDispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, DependencyObject, CoreDispatcherPriority)"/>.
         /// </remarks>
+        [Obsolete("Use the SubscribeOnWindowsRuntimeCoreDispatcher extension method defined by System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, DependencyObject dependencyObject, CoreDispatcherPriority priority)
         {
             if (source == null)
@@ -267,7 +352,9 @@ namespace System.Reactive.Linq
 #endif
 
         /// <summary>
-        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the current window.
+        /// Obsolete. Use the <c>SubscribeOnCurrentWindowsRuntimeCoreDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
@@ -277,6 +364,7 @@ namespace System.Reactive.Linq
         /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the current window.
         /// In order to invoke observer callbacks on the dispatcher associated with the current window, e.g. to render results in a control, use <see cref="CoreDispatcherObservable.ObserveOnCoreDispatcher{TSource}(IObservable{TSource})"/>.
         /// </remarks>
+        [Obsolete("Use the SubscribeOnCurrentWindowsRuntimeCoreDispatcher extension method defined by System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IObservable<TSource> SubscribeOnCoreDispatcher<TSource>(this IObservable<TSource> source)
         {
             if (source == null)
@@ -288,7 +376,9 @@ namespace System.Reactive.Linq
         }
 
         /// <summary>
-        /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the current window.
+        /// Obsolete. Use the <c>SubscribeOnCurrentWindowsRuntimeCoreDispatcher</c> extension method defined by
+        /// <c>System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable</c> in the
+        /// <c>System.Reactive.Integration.WindowsRuntime</c> package instead.
         /// </summary>
         /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
         /// <param name="source">Source sequence.</param>
@@ -299,6 +389,7 @@ namespace System.Reactive.Linq
         /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the current window.
         /// In order to invoke observer callbacks on the dispatcher associated with the current window, e.g. to render results in a control, use <see cref="CoreDispatcherObservable.ObserveOnDispatcher{TSource}(IObservable{TSource}, CoreDispatcherPriority)"/>.
         /// </remarks>
+        [Obsolete("Use the SubscribeOnCurrentWindowsRuntimeCoreDispatcher extension method defined by System.Reactive.Linq.WindowsRuntimeCoreDispatcherObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IObservable<TSource> SubscribeOnDispatcher<TSource>(this IObservable<TSource> source, CoreDispatcherPriority priority)
         {
             if (source == null)

+ 70 - 1
Rx.NET/Source/src/System.Reactive/Platforms/UWP/Linq/WindowsObservable.Events.cs

@@ -8,8 +8,74 @@ using Windows.Foundation;
 namespace System.Reactive.Linq
 {
     /// <summary>
-    /// Provides a set of static methods for importing typed events from Windows Runtime APIs.
+    /// Obsolete. The <c>System.Reactive.Integration.WindowsRuntime</c> NuGet package defines a
+    /// <c>WindowsRuntimeObservable</c> class (also in the <c>System.Reactive.Linq</c> namespace)
+    /// to use instead.
     /// </summary>
+    /// <remarks>
+    /// <para>
+    /// The replacement <c>WindowsRuntimeObservable</c> class uses different names for extension
+    /// methods. When you migrate to that new class from this obsolete one, you will need to change
+    /// your code to invoke different method names:
+    /// </para>
+    /// <list type="table">
+    ///     <listheader><term>Rx &lt;= 6.0</term><term>Now</term></listheader>
+    ///     <item>
+    ///         <term><c>ToEventPattern</c></term>
+    ///         <term><c>ToWindowsFoundationEventPattern</c></term>
+    ///     </item>
+    ///     <item>
+    ///         <term><c>SelectMany</c></term>
+    ///         <term><c>SelectManyIAsyncOperation</c> or <c>SelectManyIAsyncOperationWithProgress</c></term>
+    ///     </item>
+    /// </list>
+    /// <para>
+    /// (Note that the <c>FromEventPattern</c> method name has not changed.)
+    /// </para>
+    /// <para>
+    /// The name changes are necessary because of a limitation of the <c>Obsolete</c> attribute: if
+    /// you want to move an existing extension method into a different package, and you leave the
+    /// old one in place (and marked as <c>Obsolete</c>) for a few versions to enable a gradual
+    /// transition to the new one, you will cause a problem if you keep the method name the same.
+    /// The problem is that both the old and new extension methods will be in scope simultaneously,
+    /// so the compiler will complain of ambiguity when you try to use them. In some cases you can
+    /// mitigate this by defining the new type in a different namespace, but the problem is that
+    /// these extension methods for <see cref="IObservable{T}"/> are defined in the
+    /// <c>System.Reactive.Linq</c> namespace. Code often brings that namespace into scope for more
+    /// than one reason, so we can't just tell developers to replace <c>using
+    /// System.Reactive.Linq;</c> with some other namespace. While that might fix the ambiguity
+    /// problem, it's likely to cause a load of new problems instead.
+    /// </para>
+    /// <para>
+    /// The only practical solution for this is for the new methods to have different names than
+    /// the old ones. (There is a proposal for being able to annotate a method as being for binary
+    /// compatibility only, but it will be some time before that is available to all projects using
+    /// Rx.NET.)
+    /// </para>
+    /// <para>
+    /// The <c>FromEventPattern</c> methods keep the same name because those are not extension
+    /// methods, so they are always invoked through their class name. The replacement class has a
+    /// different name, <c>WindowsRuntimeObservable</c>, so there is no ambiguity.
+    /// </para>
+    /// <para>
+    /// This type will eventually be removed because all UI-framework-specific functionality is
+    /// being removed from <c>System.Reactive</c>. This is necessary to fix problems in which
+    /// <c>System.Reactive</c> causes applications to end up with dependencies on Windows Forms and
+    /// WPF whether they want them or not. Strictly speaking, the <see cref="IAsyncAction"/>,
+    /// <see cref="IAsyncActionWithProgress{TProgress}"/>, <see cref="IAsyncOperation{TResult}"/>
+    /// and <see cref="IAsyncOperationWithProgress{TResult, TProgress}"/> types that this class
+    /// supports are part of Windows Runtime, and aren't specific to a single UI framework. These
+    /// types are used routinely in both UWP and WinUI applications, but it's also possible to use
+    /// them from Windows Forms, WPF, and even console applications. These types are effectively
+    /// WinRT native way of representing what the TPL's various Task types represent in a purely
+    /// .NET world. Even so, once support for genuinely UI-framework-specific types (such as
+    /// WPF's <c>Dispatcher</c>) has been removed from Rx.NET, support for these Windows Runtime
+    /// types would require us to continue to offer <c>netX.0</c> and <c>netX.0-windows10.0.YYYYY</c>
+    /// TFMs. The fact that we offer both has caused confusion because it's quite possible to get the
+    /// former even when running on Windows.
+    /// </para>
+       /// </remarks>
+    [Obsolete("Use the System.Reactive.Linq.WindowsRuntimeObservable class in the System.Reactive.Integration.WindowsRuntime instead", error: false)]
     [CLSCompliant(false)]
     public static partial class WindowsObservable
     {
@@ -23,6 +89,7 @@ namespace System.Reactive.Linq
         /// <returns>The observable sequence that contains data representations of invocations of the underlying typed event.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="addHandler"/> or <paramref name="removeHandler"/> is null.</exception>
         /// <seealso cref="ToEventPattern"/>
+        [Obsolete("Use the FromEventPattern method defined by System.Reactive.Linq.WindowsRuntimeObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IObservable<EventPattern<TSender, TResult>> FromEventPattern<TSender, TResult>(Action<TypedEventHandler<TSender, TResult>> addHandler, Action<TypedEventHandler<TSender, TResult>> removeHandler)
         {
             if (addHandler == null)
@@ -63,6 +130,7 @@ namespace System.Reactive.Linq
         /// <returns>The observable sequence that contains data representations of invocations of the underlying typed event.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="conversion"/> or <paramref name="addHandler"/> or <paramref name="removeHandler"/> is null.</exception>
         /// <seealso cref="ToEventPattern"/>
+        [Obsolete("Use the FromEventPattern method defined by System.Reactive.Linq.WindowsRuntimeObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IObservable<EventPattern<TSender, TResult>> FromEventPattern<TDelegate, TSender, TResult>(Func<TypedEventHandler<TSender, TResult>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler)
         {
             if (conversion == null)
@@ -104,6 +172,7 @@ namespace System.Reactive.Linq
         /// <param name="source">Observable source sequence.</param>
         /// <returns>The event source object.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
+        [Obsolete("Use the ToWindowsFoundationEventPattern extension method defined by System.Reactive.Linq.WindowsRuntimeObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IEventPatternSource<TSender, TEventArgs> ToEventPattern<TSender, TEventArgs>(this IObservable<EventPattern<TSender, TEventArgs>> source)
         {
             if (source == null)

+ 4 - 0
Rx.NET/Source/src/System.Reactive/Platforms/UWP/Linq/WindowsObservable.StandardSequenceOperators.cs

@@ -20,6 +20,7 @@ namespace System.Reactive.Linq
         /// <returns>An observable sequence whose elements are the result of the asynchronous operations executed for each element of the input sequence.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
         /// <remarks>This overload supports composition of observable sequences and Windows Runtime asynchronous operations, without requiring manual conversion of the asynchronous operations to observable sequences using <see cref="AsyncInfoObservableExtensions.ToObservable{TResult}(IAsyncOperation{TResult})"/>.</remarks>
+        [Obsolete("Use the SelectManyIAsyncOperation extension method defined by System.Reactive.Linq.WindowsRuntimeObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IObservable<TResult> SelectMany<TSource, TResult>(this IObservable<TSource> source, Func<TSource, IAsyncOperation<TResult>> selector)
         {
             if (source == null)
@@ -46,6 +47,7 @@ namespace System.Reactive.Linq
         /// <returns>An observable sequence whose elements are the result of the asynchronous operations executed for each element of the input sequence.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
         /// <remarks>This overload supports composition of observable sequences and Windows Runtime asynchronous operations, without requiring manual conversion of the asynchronous operations to observable sequences using <see cref="AsyncInfoObservableExtensions.ToObservable{TResult}(IAsyncOperation{TResult})"/>.</remarks>
+        [Obsolete("Use the SelectManyIAsyncOperationWithProgress extension method defined by System.Reactive.Linq.WindowsRuntimeObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IObservable<TResult> SelectMany<TSource, TResult, TProgress>(this IObservable<TSource> source, Func<TSource, IAsyncOperationWithProgress<TResult, TProgress>> selector)
         {
             if (source == null)
@@ -73,6 +75,7 @@ namespace System.Reactive.Linq
         /// <returns>An observable sequence whose elements are the result of obtaining an asynchronous operation for each element of the input sequence and then mapping the asynchronous operation's result and its corresponding source element to a result element.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="asyncOperationSelector"/> or <paramref name="resultSelector"/> is null.</exception>
         /// <remarks>This overload supports using LINQ query comprehension syntax in C# and Visual Basic to compose observable sequences and Windows Runtime asynchronous operations, without requiring manual conversion of the asynchronous operations to observable sequences using <see cref="AsyncInfoObservableExtensions.ToObservable{TResult}(IAsyncOperation{TResult})"/>.</remarks>
+        [Obsolete("Use the SelectManyIAsyncOperation extension method defined by System.Reactive.Linq.WindowsRuntimeObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IObservable<TResult> SelectMany<TSource, TAsyncOperationResult, TResult>(this IObservable<TSource> source, Func<TSource, IAsyncOperation<TAsyncOperationResult>> asyncOperationSelector, Func<TSource, TAsyncOperationResult, TResult> resultSelector)
         {
             if (source == null)
@@ -106,6 +109,7 @@ namespace System.Reactive.Linq
         /// <returns>An observable sequence whose elements are the result of obtaining an asynchronous operation for each element of the input sequence and then mapping the asynchronous operation's result and its corresponding source element to a result element.</returns>
         /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="asyncOperationSelector"/> or <paramref name="resultSelector"/> is null.</exception>
         /// <remarks>This overload supports using LINQ query comprehension syntax in C# and Visual Basic to compose observable sequences and Windows Runtime asynchronous operations, without requiring manual conversion of the asynchronous operations to observable sequences using <see cref="AsyncInfoObservableExtensions.ToObservable{TResult}(IAsyncOperation{TResult})"/>.</remarks>
+        [Obsolete("Use the SelectManyIAsyncOperationWithProgress extension method defined by System.Reactive.Linq.WindowsRuntimeObservable in the System.Reactive.Integration.WindowsRuntime package instead", error: false)]
         public static IObservable<TResult> SelectMany<TSource, TAsyncOperationResult, TAsyncOperationProgress, TResult>(this IObservable<TSource> source, Func<TSource, IAsyncOperationWithProgress<TAsyncOperationResult, TAsyncOperationProgress>> asyncOperationSelector, Func<TSource, TAsyncOperationResult, TResult> resultSelector)
         {
             if (source == null)

+ 5 - 0
Rx.NET/Source/tests/Tests.System.Reactive/Tests.System.Reactive.csproj

@@ -36,4 +36,9 @@
     <ProjectReference Include="..\..\src\System.Reactive.Observable.Aliases\System.Reactive.Observable.Aliases.csproj" />
     <ProjectReference Include="..\..\src\Microsoft.Reactive.Testing\Microsoft.Reactive.Testing.csproj" />
   </ItemGroup>
+
+  <ItemGroup Condition="'$(TargetFramework)' == 'net472' or $(TargetFramework.StartsWith('net6.0-windows')) or $(TargetFramework.StartsWith('net8.0-windows'))">
+    <ProjectReference Include="..\..\src\System.Reactive.Integration.WindowsForms\System.Reactive.Integration.WindowsForms.csproj" />
+    <ProjectReference Include="..\..\src\System.Reactive.Integration.Wpf\System.Reactive.Integration.Wpf.csproj" />
+  </ItemGroup>
 </Project>

+ 266 - 0
Rx.NET/Source/tests/Tests.System.Reactive/Tests/Concurrency/ControlSchedulerTest.cs

@@ -14,6 +14,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Microsoft.Reactive.Testing;
 
 using Assert = Xunit.Assert;
+using LegacyControlScheduler = System.Reactive.Concurrency.ControlScheduler;
+using ControlScheduler = System.Reactive.Integration.WindowsForms.ControlScheduler;
 
 namespace ReactiveTests.Tests
 {
@@ -25,6 +27,7 @@ namespace ReactiveTests.Tests
         {
 #pragma warning disable CA1806 // (Unused new instance.) We expect the constructor to throw.
             ReactiveAssert.Throws<ArgumentNullException>(() => new ControlScheduler(null));
+            ReactiveAssert.Throws<ArgumentNullException>(() => new LegacyControlScheduler(null));
 #pragma warning restore CA1806
         }
 
@@ -33,6 +36,7 @@ namespace ReactiveTests.Tests
         {
             var lbl = new Label();
             Assert.Same(lbl, new ControlScheduler(lbl).Control);
+            Assert.Same(lbl, new LegacyControlScheduler(lbl).Control);
         }
 
         [TestMethod]
@@ -42,6 +46,13 @@ namespace ReactiveTests.Tests
             Assert.True(res.Seconds < 1);
         }
 
+        [TestMethod]
+        public void NowLegacy()
+        {
+            var res = new LegacyControlScheduler(new Label()).Now - DateTime.Now;
+            Assert.True(res.Seconds < 1);
+        }
+
         [TestMethod]
         public void Schedule_ArgumentChecking()
         {
@@ -51,6 +62,15 @@ namespace ReactiveTests.Tests
             ReactiveAssert.Throws<ArgumentNullException>(() => s.Schedule(42, DateTimeOffset.Now, default(Func<IScheduler, int, IDisposable>)));
         }
 
+        [TestMethod]
+        public void Schedule_ArgumentChecking_Legacy()
+        {
+            var s = new LegacyControlScheduler(new Label());
+            ReactiveAssert.Throws<ArgumentNullException>(() => s.Schedule(42, default(Func<IScheduler, int, IDisposable>)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => s.Schedule(42, TimeSpan.FromSeconds(1), default(Func<IScheduler, int, IDisposable>)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => s.Schedule(42, DateTimeOffset.Now, default(Func<IScheduler, int, IDisposable>)));
+        }
+
         [TestMethod]
         public void Schedule()
         {
@@ -69,6 +89,24 @@ namespace ReactiveTests.Tests
             }
         }
 
+        [TestMethod]
+        public void Schedule_Legacy()
+        {
+            using (WinFormsTestUtils.RunTest(out var lbl))
+            {
+                var evt = new ManualResetEvent(false);
+
+                var id = Environment.CurrentManagedThreadId;
+
+                var sch = new LegacyControlScheduler(lbl);
+                
+                sch.Schedule(() => { lbl.Text = "Okay"; Assert.NotEqual(id, Environment.CurrentManagedThreadId); });
+                sch.Schedule(() => { Assert.Equal("Okay", lbl.Text); Assert.NotEqual(id, Environment.CurrentManagedThreadId); evt.Set(); });
+
+                evt.WaitOne();
+            }
+        }
+
         [TestMethod]
         public void ScheduleError()
         {
@@ -94,18 +132,55 @@ namespace ReactiveTests.Tests
             }
         }
 
+        [TestMethod]
+        public void ScheduleError_Legacy()
+        {
+            using (WinFormsTestUtils.RunTest(out var lbl))
+            {
+                var evt = new ManualResetEvent(false);
+
+                var ex = new Exception();
+
+                lbl.Invoke(new Action(() =>
+                {
+                    Application.ThreadException += (o, e) =>
+                    {
+                        Assert.Same(ex, e.Exception);
+                        evt.Set();
+                    };
+                }));
+
+                var sch = new LegacyControlScheduler(lbl);
+                sch.Schedule(() => { throw ex; });
+
+                evt.WaitOne();
+            }
+        }
+
         [TestMethod]
         public void ScheduleRelative()
         {
             ScheduleRelative_(TimeSpan.FromSeconds(0.1));
         }
 
+        [TestMethod]
+        public void ScheduleRelative_Legacy()
+        {
+            ScheduleRelative_Legacy_(TimeSpan.FromSeconds(0.1));
+        }
+
         [TestMethod]
         public void ScheduleRelative_Zero()
         {
             ScheduleRelative_(TimeSpan.Zero);
         }
 
+        [TestMethod]
+        public void ScheduleRelative_Zero_Legacy()
+        {
+            ScheduleRelative_Legacy_(TimeSpan.Zero);
+        }
+
         private void ScheduleRelative_(TimeSpan delay)
         {
             using (WinFormsTestUtils.RunTest(out var lbl))
@@ -133,6 +208,33 @@ namespace ReactiveTests.Tests
             }
         }
 
+        private void ScheduleRelative_Legacy_(TimeSpan delay)
+        {
+            using (WinFormsTestUtils.RunTest(out var lbl))
+            {
+                var evt = new ManualResetEvent(false);
+
+                var id = Environment.CurrentManagedThreadId;
+                
+                var sch = new LegacyControlScheduler(lbl);
+
+                sch.Schedule(delay, () =>
+                {
+                    lbl.Text = "Okay";
+                    Assert.NotEqual(id, Environment.CurrentManagedThreadId);
+                    
+                    sch.Schedule(() =>
+                    {
+                        Assert.Equal("Okay", lbl.Text);
+                        Assert.NotEqual(id, Environment.CurrentManagedThreadId);
+                        evt.Set();
+                    });
+                });
+
+                evt.WaitOne();
+            }
+        }
+
         [TestMethod]
         public void ScheduleRelative_Nested()
         {
@@ -164,6 +266,37 @@ namespace ReactiveTests.Tests
             }
         }
 
+        [TestMethod]
+        public void ScheduleRelative_Nested_Legacy()
+        {
+            using (WinFormsTestUtils.RunTest(out var lbl))
+            {
+                var evt = new ManualResetEvent(false);
+
+                var id = Environment.CurrentManagedThreadId;
+
+                var sch = new LegacyControlScheduler(lbl);
+
+                sch.Schedule(TimeSpan.FromSeconds(0.1), () =>
+                {
+                    sch.Schedule(TimeSpan.FromSeconds(0.1), () =>
+                    {
+                        lbl.Text = "Okay";
+                        Assert.NotEqual(id, Environment.CurrentManagedThreadId);
+
+                        sch.Schedule(() =>
+                        {
+                            Assert.Equal("Okay", lbl.Text);
+                            Assert.NotEqual(id, Environment.CurrentManagedThreadId);
+                            evt.Set();
+                        });
+                    });
+                });
+
+                evt.WaitOne();
+            }
+        }
+
         [TestMethod]
         public void ScheduleRelative_Cancel()
         {
@@ -202,6 +335,44 @@ namespace ReactiveTests.Tests
             }
         }
 
+        [TestMethod]
+        public void ScheduleRelative_Cancel_Legacy()
+        {
+            using (WinFormsTestUtils.RunTest(out var lbl))
+            {
+                var evt = new ManualResetEvent(false);
+
+                var id = Environment.CurrentManagedThreadId;
+
+                var sch = new LegacyControlScheduler(lbl);
+
+                sch.Schedule(TimeSpan.FromSeconds(0.1), () =>
+                {
+                    lbl.Text = "Okay";
+                    Assert.NotEqual(id, Environment.CurrentManagedThreadId);
+
+                    var d = sch.Schedule(TimeSpan.FromSeconds(0.1), () =>
+                    {
+                        lbl.Text = "Oops!";
+                    });
+
+                    sch.Schedule(() =>
+                    {
+                        d.Dispose();
+                    });
+
+                    sch.Schedule(TimeSpan.FromSeconds(0.2), () =>
+                    {
+                        Assert.Equal("Okay", lbl.Text);
+                        Assert.NotEqual(id, Environment.CurrentManagedThreadId);
+                        evt.Set();
+                    });
+                });
+
+                evt.WaitOne();
+            }
+        }
+
         [TestMethod]
         public void SchedulePeriodic_ArgumentChecking()
         {
@@ -213,6 +384,17 @@ namespace ReactiveTests.Tests
             ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => s.SchedulePeriodic(42, TimeSpan.FromMilliseconds(1).Subtract(TimeSpan.FromTicks(1)), x => x));
         }
 
+        [TestMethod]
+        public void SchedulePeriodic_ArgumentChecking_Legacy()
+        {
+            var s = new LegacyControlScheduler(new Label());
+#pragma warning disable IDE0034 // (Simplify 'default'.) Want to be explicit about overload being tested.
+            ReactiveAssert.Throws<ArgumentNullException>(() => s.SchedulePeriodic(42, TimeSpan.FromSeconds(1), default(Func<int, int>)));
+#pragma warning restore IDE0034
+            ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => s.SchedulePeriodic(42, TimeSpan.Zero, x => x));
+            ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => s.SchedulePeriodic(42, TimeSpan.FromMilliseconds(1).Subtract(TimeSpan.FromTicks(1)), x => x));
+        }
+
         [TestMethod]
         public void SchedulePeriodic()
         {
@@ -255,6 +437,48 @@ namespace ReactiveTests.Tests
             }
         }
 
+        [TestMethod]
+        public void SchedulePeriodic_Legacy()
+        {
+            using (WinFormsTestUtils.RunTest(out var lbl))
+            {
+                var evt = new ManualResetEvent(false);
+
+                var id = Environment.CurrentManagedThreadId;
+
+                var sch = new LegacyControlScheduler(lbl);
+
+                var d = new SingleAssignmentDisposable();
+
+                d.Disposable = sch.SchedulePeriodic(1, TimeSpan.FromSeconds(0.1), n =>
+                {
+                    lbl.Text = "Okay " + n;
+                    Assert.NotEqual(id, Environment.CurrentManagedThreadId);
+
+                    if (n == 3)
+                    {
+                        d.Dispose();
+
+                        sch.Schedule(TimeSpan.FromSeconds(0.2), () =>
+                        {
+                            Assert.Equal("Okay 3", lbl.Text);
+                            Assert.NotEqual(id, Environment.CurrentManagedThreadId);
+                            evt.Set();
+                        });
+                    }
+
+                    if (n > 3)
+                    {
+                        Assert.True(false);
+                    }
+
+                    return n + 1;
+                });
+
+                evt.WaitOne();
+            }
+        }
+
         [TestMethod]
         public void SchedulePeriodic_Nested()
         {
@@ -296,6 +520,48 @@ namespace ReactiveTests.Tests
                 evt.WaitOne();
             }
         }
+
+        [TestMethod]
+        public void SchedulePeriodic_Nested_Legacy()
+        {
+            using (WinFormsTestUtils.RunTest(out var lbl))
+            {
+                var evt = new ManualResetEvent(false);
+
+                var id = Environment.CurrentManagedThreadId;
+
+                var sch = new LegacyControlScheduler(lbl);
+
+                sch.Schedule(() =>
+                {
+                    lbl.Text = "Okay";
+
+                    var d = new SingleAssignmentDisposable();
+
+                    d.Disposable = sch.SchedulePeriodic(1, TimeSpan.FromSeconds(0.1), n =>
+                    {
+                        lbl.Text = "Okay " + n;
+                        Assert.NotEqual(id, Environment.CurrentManagedThreadId);
+
+                        if (n == 3)
+                        {
+                            d.Dispose();
+
+                            sch.Schedule(TimeSpan.FromSeconds(0.2), () =>
+                            {
+                                Assert.Equal("Okay 3", lbl.Text);
+                                Assert.NotEqual(id, Environment.CurrentManagedThreadId);
+                                evt.Set();
+                            });
+                        }
+
+                        return n + 1;
+                    });
+                });
+
+                evt.WaitOne();
+            }
+        }
     }
 }
 #endif

+ 253 - 0
Rx.NET/Source/tests/Tests.System.Reactive/Tests/Concurrency/DispatcherSchedulerTest.cs

@@ -13,6 +13,8 @@ using Microsoft.Reactive.Testing;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 
 using Assert = Xunit.Assert;
+using LegacyDispatcherScheduler = System.Reactive.Concurrency.DispatcherScheduler;
+using DispatcherScheduler = System.Reactive.Integration.Wpf.DispatcherScheduler;
 
 namespace ReactiveTests.Tests
 {
@@ -27,6 +29,14 @@ namespace ReactiveTests.Tests
 #pragma warning restore CA1806
         }
 
+        [TestMethod]
+        public void Ctor_ArgumentChecking_Legacy()
+        {
+#pragma warning disable CA1806 // (Unused new instance.) We expect the constructor to throw.
+            ReactiveAssert.Throws<ArgumentNullException>(() => new LegacyDispatcherScheduler(null));
+#pragma warning restore CA1806
+        }
+
         [TestMethod]
         public void Current()
         {
@@ -44,6 +54,23 @@ namespace ReactiveTests.Tests
             }
         }
 
+        [TestMethod]
+        public void Current_Legacy()
+        {
+            using (DispatcherHelpers.RunTest(out var d))
+            {
+                var e = new ManualResetEvent(false);
+
+                d.BeginInvoke(() =>
+                {
+                    var c = LegacyDispatcherScheduler.Current;
+                    c.Schedule(() => { e.Set(); });
+                });
+
+                e.WaitOne();
+            }
+        }
+
         [TestMethod]
         public void Current_None()
         {
@@ -67,6 +94,29 @@ namespace ReactiveTests.Tests
             Assert.True(e != null && e is InvalidOperationException);
         }
 
+        [TestMethod]
+        public void Current_None_Legacy()
+        {
+            var e = default(Exception);
+
+            var t = new Thread(() =>
+            {
+                try
+                {
+                    var ignored = LegacyDispatcherScheduler.Current;
+                }
+                catch (Exception ex)
+                {
+                    e = ex;
+                }
+            });
+
+            t.Start();
+            t.Join();
+
+            Assert.True(e != null && e is InvalidOperationException);
+        }
+
         [TestMethod]
         public void Dispatcher()
         {
@@ -76,6 +126,15 @@ namespace ReactiveTests.Tests
             }
         }
 
+        [TestMethod]
+        public void Dispatcher_Legacy()
+        {
+            using (DispatcherHelpers.RunTest(out var disp))
+            {
+                Assert.Same(disp.Dispatcher, new LegacyDispatcherScheduler(disp).Dispatcher);
+            }
+        }
+
         [TestMethod]
         public void Now()
         {
@@ -86,6 +145,16 @@ namespace ReactiveTests.Tests
             }
         }
 
+        [TestMethod]
+        public void Now_Legacy()
+        {
+            using (DispatcherHelpers.RunTest(out var disp))
+            {
+                var res = new LegacyDispatcherScheduler(disp).Now - DateTime.Now;
+                Assert.True(res.Seconds < 1);
+            }
+        }
+
         [TestMethod]
         public void Schedule_ArgumentChecking()
         {
@@ -98,6 +167,18 @@ namespace ReactiveTests.Tests
             }
         }
 
+        [TestMethod]
+        public void Schedule_ArgumentChecking_Legacy()
+        {
+            using (DispatcherHelpers.RunTest(out var disp))
+            {
+                var s = new LegacyDispatcherScheduler(disp);
+                ReactiveAssert.Throws<ArgumentNullException>(() => s.Schedule(42, default(Func<IScheduler, int, IDisposable>)));
+                ReactiveAssert.Throws<ArgumentNullException>(() => s.Schedule(42, TimeSpan.FromSeconds(1), default(Func<IScheduler, int, IDisposable>)));
+                ReactiveAssert.Throws<ArgumentNullException>(() => s.Schedule(42, DateTimeOffset.Now, default(Func<IScheduler, int, IDisposable>)));
+            }
+        }
+
         [TestMethod]
         [Asynchronous]
         public void Schedule()
@@ -117,6 +198,25 @@ namespace ReactiveTests.Tests
             }
         }
 
+        [TestMethod]
+        [Asynchronous]
+        public void Schedule_Legacy()
+        {
+            using (DispatcherHelpers.RunTest(out var disp))
+            {
+                RunAsync(evt =>
+                {
+                    var id = Environment.CurrentManagedThreadId;
+                    var sch = new LegacyDispatcherScheduler(disp);
+                    sch.Schedule(() =>
+                    {
+                        Assert.NotEqual(id, Environment.CurrentManagedThreadId);
+                        evt.Set();
+                    });
+                });
+            }
+        }
+
         [TestMethod]
         public void ScheduleError()
         {
@@ -142,18 +242,55 @@ namespace ReactiveTests.Tests
             }
         }
 
+        [TestMethod]
+        public void ScheduleError_Legacy()
+        {
+            using (DispatcherHelpers.RunTest(out var disp))
+            {
+                var ex = new Exception();
+
+                var id = Environment.CurrentManagedThreadId;
+                var evt = new ManualResetEvent(false);
+
+                Exception thrownEx = null;
+                disp.UnhandledException += (o, e) =>
+                {
+                    thrownEx = e.Exception;
+                    evt.Set();
+                    e.Handled = true;
+                };
+                var sch = new LegacyDispatcherScheduler(disp);
+                sch.Schedule(() => { throw ex; });
+                evt.WaitOne();
+
+                Assert.Same(ex, thrownEx);
+            }
+        }
+
         [TestMethod]
         public void ScheduleRelative()
         {
             ScheduleRelative_(TimeSpan.FromSeconds(0.2));
         }
 
+        [TestMethod]
+        public void ScheduleRelative_Legacy()
+        {
+            ScheduleRelative_Legacy_(TimeSpan.FromSeconds(0.2));
+        }
+
         [TestMethod]
         public void ScheduleRelative_Zero()
         {
             ScheduleRelative_(TimeSpan.Zero);
         }
 
+        [TestMethod]
+        public void ScheduleRelative_Zero_Legacy()
+        {
+            ScheduleRelative_Legacy_(TimeSpan.Zero);
+        }
+
         private void ScheduleRelative_(TimeSpan delay)
         {
             using (DispatcherHelpers.RunTest(out var disp))
@@ -179,6 +316,31 @@ namespace ReactiveTests.Tests
             }
         }
 
+        private void ScheduleRelative_Legacy_(TimeSpan delay)
+        {
+            using (DispatcherHelpers.RunTest(out var disp))
+            {
+                var evt = new ManualResetEvent(false);
+
+                var id = Environment.CurrentManagedThreadId;
+
+                var sch = new DispatcherScheduler(disp);
+
+                sch.Schedule(delay, () =>
+                {
+                    Assert.NotEqual(id, Environment.CurrentManagedThreadId);
+
+                    sch.Schedule(delay, () =>
+                    {
+                        Assert.NotEqual(id, Environment.CurrentManagedThreadId);
+                        evt.Set();
+                    });
+                });
+
+                evt.WaitOne();
+            }
+        }
+
         [TestMethod]
         public void ScheduleRelative_Cancel()
         {
@@ -216,6 +378,43 @@ namespace ReactiveTests.Tests
             }
         }
 
+        [TestMethod]
+        public void ScheduleRelative_Cancel_Legacy()
+        {
+            using (DispatcherHelpers.RunTest(out var disp))
+            {
+                var evt = new ManualResetEvent(false);
+
+                var id = Environment.CurrentManagedThreadId;
+
+                var sch = new LegacyDispatcherScheduler(disp);
+
+                sch.Schedule(TimeSpan.FromSeconds(0.1), () =>
+                {
+                    Assert.NotEqual(id, Environment.CurrentManagedThreadId);
+
+                    var d = sch.Schedule(TimeSpan.FromSeconds(0.1), () =>
+                    {
+                        Assert.True(false);
+                        evt.Set();
+                    });
+
+                    sch.Schedule(() =>
+                    {
+                        d.Dispose();
+                    });
+
+                    sch.Schedule(TimeSpan.FromSeconds(0.2), () =>
+                    {
+                        Assert.NotEqual(id, Environment.CurrentManagedThreadId);
+                        evt.Set();
+                    });
+                });
+
+                evt.WaitOne();
+            }
+        }
+
         [TestMethod]
         public void SchedulePeriodic_ArgumentChecking()
         {
@@ -223,6 +422,20 @@ namespace ReactiveTests.Tests
             {
                 var s = new DispatcherScheduler(disp);
 
+#pragma warning disable IDE0034 // (Simplify 'default'.) Want to be explicit about overload being tested.
+                ReactiveAssert.Throws<ArgumentNullException>(() => s.SchedulePeriodic(42, TimeSpan.FromSeconds(1), default(Func<int, int>)));
+#pragma warning restore IDE0034
+                ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => s.SchedulePeriodic(42, TimeSpan.FromSeconds(-1), x => x));
+            }
+        }
+
+        [TestMethod]
+        public void SchedulePeriodic_ArgumentChecking_Legacy()
+        {
+            using (DispatcherHelpers.RunTest(out var disp))
+            {
+                var s = new LegacyDispatcherScheduler(disp);
+
 #pragma warning disable IDE0034 // (Simplify 'default'.) Want to be explicit about overload being tested.
                 ReactiveAssert.Throws<ArgumentNullException>(() => s.SchedulePeriodic(42, TimeSpan.FromSeconds(1), default(Func<int, int>)));
 #pragma warning restore IDE0034
@@ -269,6 +482,46 @@ namespace ReactiveTests.Tests
                 evt.WaitOne();
             }
         }
+
+        [TestMethod]
+        public void SchedulePeriodic_Legacy()
+        {
+            using (DispatcherHelpers.RunTest(out var disp))
+            {
+                var evt = new ManualResetEvent(false);
+
+                var id = Environment.CurrentManagedThreadId;
+
+                var sch = new LegacyDispatcherScheduler(disp);
+
+                var d = new SingleAssignmentDisposable();
+
+                d.Disposable = sch.SchedulePeriodic(1, TimeSpan.FromSeconds(0.1), n =>
+                {
+                    Assert.NotEqual(id, Environment.CurrentManagedThreadId);
+
+                    if (n == 3)
+                    {
+                        d.Dispose();
+
+                        sch.Schedule(TimeSpan.FromSeconds(0.2), () =>
+                        {
+                            Assert.NotEqual(id, Environment.CurrentManagedThreadId);
+                            evt.Set();
+                        });
+                    }
+
+                    if (n > 3)
+                    {
+                        Assert.True(false);
+                    }
+
+                    return n + 1;
+                });
+
+                evt.WaitOne();
+            }
+        }
     }
 }
 #endif

+ 19 - 4
Rx.NET/Source/tests/Tests.System.Reactive/Tests/Concurrency/SchedulerTest.cs

@@ -16,6 +16,13 @@ using Microsoft.Reactive.Testing;
 
 #if HAS_WINFORMS
 using System.Windows.Forms;
+using LegacyControlScheduler = System.Reactive.Concurrency.ControlScheduler;
+using ControlScheduler = System.Reactive.Integration.WindowsForms.ControlScheduler;
+#endif
+
+#if HAS_WPF
+using LegacyDispatcherScheduler = System.Reactive.Concurrency.DispatcherScheduler;
+using DispatcherScheduler = System.Reactive.Integration.Wpf.DispatcherScheduler;
 #endif
 
 using System.Threading.Tasks;
@@ -59,10 +66,14 @@ namespace ReactiveTests.Tests
             ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.CurrentThread.Schedule(TimeSpan.Zero, default(Action)));
             ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.CurrentThread.Schedule(DateTimeOffset.MaxValue, default(Action)));
 #if DESKTOPCLR
-            ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherScheduler.Instance.Schedule(default(Action)));
-            ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherScheduler.Instance.ScheduleAction(new object(), default));
-            ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherScheduler.Instance.Schedule(TimeSpan.Zero, default(Action)));
-            ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherScheduler.Instance.Schedule(DateTimeOffset.MaxValue, default(Action)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherScheduler.Current.Schedule(default(Action)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherScheduler.Current.ScheduleAction(new object(), default));
+            ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherScheduler.Current.Schedule(TimeSpan.Zero, default(Action)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherScheduler.Current.Schedule(DateTimeOffset.MaxValue, default(Action)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => LegacyDispatcherScheduler.Current.Schedule(default(Action)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => LegacyDispatcherScheduler.Current.ScheduleAction(new object(), default));
+            ReactiveAssert.Throws<ArgumentNullException>(() => LegacyDispatcherScheduler.Current.Schedule(TimeSpan.Zero, default(Action)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => LegacyDispatcherScheduler.Current.Schedule(DateTimeOffset.MaxValue, default(Action)));
 #endif
             ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Immediate.Schedule(default(Action)));
             ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Immediate.ScheduleAction(new object(), default));
@@ -88,6 +99,10 @@ namespace ReactiveTests.Tests
             ReactiveAssert.Throws<ArgumentNullException>(() => new ControlScheduler(lbl).ScheduleAction(new object(), default(Action<object>)));
             ReactiveAssert.Throws<ArgumentNullException>(() => new ControlScheduler(lbl).Schedule(TimeSpan.Zero, default(Action)));
             ReactiveAssert.Throws<ArgumentNullException>(() => new ControlScheduler(lbl).Schedule(DateTimeOffset.MaxValue, default(Action)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => new LegacyControlScheduler(lbl).Schedule(default(Action)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => new LegacyControlScheduler(lbl).ScheduleAction(new object(), default(Action<object>)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => new LegacyControlScheduler(lbl).Schedule(TimeSpan.Zero, default(Action)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => new LegacyControlScheduler(lbl).Schedule(DateTimeOffset.MaxValue, default(Action)));
 #endif
             var ctx = new SynchronizationContext();
             ReactiveAssert.Throws<ArgumentNullException>(() => new SynchronizationContextScheduler(ctx).Schedule(default(Action)));

+ 118 - 4
Rx.NET/Source/tests/Tests.System.Reactive/Tests/Linq/Observable/ObserveOnTest.cs

@@ -16,10 +16,15 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
 
 #if HAS_DISPATCHER
 using System.Windows.Threading;
+
+using LegacyDispatcherScheduler = System.Reactive.Concurrency.DispatcherScheduler;
+using DispatcherScheduler = System.Reactive.Integration.Wpf.DispatcherScheduler;
 #endif
 
 #if HAS_WINFORMS
 using System.Windows.Forms;
+using LegacyControlScheduler = System.Reactive.Concurrency.ControlScheduler;
+using ControlScheduler = System.Reactive.Integration.WindowsForms.ControlScheduler;
 #endif
 
 using Assert = Xunit.Assert;
@@ -40,7 +45,11 @@ namespace ReactiveTests.Tests
 #pragma warning disable IDE0034 // (Simplify 'default'.) Want to be explicit about overloads being tested.
             ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn<int>(default(IObservable<int>), new ControlScheduler(new Label())));
             ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn<int>(someObservable, default(ControlScheduler)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn<int>(default(IObservable<int>), new LegacyControlScheduler(new Label())));
+            ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn<int>(someObservable, default(LegacyControlScheduler)));
 
+            ReactiveAssert.Throws<ArgumentNullException>(() => WindowsFormsControlObservable.ObserveOnWindowsFormsControl<int>(default(IObservable<int>), new Label()));
+            ReactiveAssert.Throws<ArgumentNullException>(() => WindowsFormsControlObservable.ObserveOnWindowsFormsControl<int>(someObservable, default(Label)));
             ReactiveAssert.Throws<ArgumentNullException>(() => ControlObservable.ObserveOn<int>(default(IObservable<int>), new Label()));
             ReactiveAssert.Throws<ArgumentNullException>(() => ControlObservable.ObserveOn<int>(someObservable, default(Label)));
 #pragma warning restore IDE0034
@@ -50,7 +59,12 @@ namespace ReactiveTests.Tests
 #pragma warning disable IDE0034 // (Simplify 'default'.) Want to be explicit about overloads being tested.
             ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn<int>(default(IObservable<int>), new DispatcherScheduler(Dispatcher.CurrentDispatcher)));
             ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn<int>(someObservable, default(DispatcherScheduler)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn<int>(default(IObservable<int>), new LegacyDispatcherScheduler(Dispatcher.CurrentDispatcher)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn<int>(someObservable, default(LegacyDispatcherScheduler)));
 
+            ReactiveAssert.Throws<ArgumentNullException>(() => WpfDispatcherObservable.ObserveOnWpfDispatcher<int>(default(IObservable<int>), Dispatcher.CurrentDispatcher));
+            ReactiveAssert.Throws<ArgumentNullException>(() => WpfDispatcherObservable.ObserveOnWpfDispatcher<int>(someObservable, default(Dispatcher)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => WpfDispatcherObservable.ObserveOnCurrentWpfDispatcher<int>(default(IObservable<int>)));
             ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherObservable.ObserveOn<int>(default(IObservable<int>), Dispatcher.CurrentDispatcher));
             ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherObservable.ObserveOn<int>(someObservable, default(Dispatcher)));
             ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherObservable.ObserveOnDispatcher<int>(default(IObservable<int>)));
@@ -66,6 +80,27 @@ namespace ReactiveTests.Tests
         {
             var okay = true;
 
+            using (WinFormsTestUtils.RunTest(out var lbl))
+            {
+                var evt = new ManualResetEvent(false);
+
+                Observable.Range(0, 10, NewThreadScheduler.Default).ObserveOnWindowsFormsControl(lbl).Subscribe(x =>
+                {
+                    lbl.Text = x.ToString();
+                    okay &= (SynchronizationContext.Current is System.Windows.Forms.WindowsFormsSynchronizationContext);
+                }, () => evt.Set());
+
+                evt.WaitOne();
+            }
+
+            Assert.True(okay);
+        }
+
+        [TestMethod]
+        public void ObserveOn_Control_Legacy()
+        {
+            var okay = true;
+
             using (WinFormsTestUtils.RunTest(out var lbl))
             {
                 var evt = new ManualResetEvent(false);
@@ -106,7 +141,28 @@ namespace ReactiveTests.Tests
 #if HAS_DISPATCHER
         [TestMethod]
         [Asynchronous]
-        public void ObserveOn_Dispatcher()
+        public void ObserveOnDispatcher()
+        {
+            using (DispatcherHelpers.RunTest(out var dispatcher))
+            {
+                RunAsync(evt =>
+                {
+                    var okay = true;
+                    Observable.Range(0, 10, NewThreadScheduler.Default).ObserveOnWpfDispatcher(dispatcher).Subscribe(x =>
+                    {
+                        okay &= (SynchronizationContext.Current is System.Windows.Threading.DispatcherSynchronizationContext);
+                    }, () =>
+                    {
+                        Assert.True(okay);
+                        evt.Set();
+                    });
+                });
+            }
+        }
+
+        [TestMethod]
+        [Asynchronous]
+        public void ObserveOn_Dispatcher_Legacy()
         {
             using (DispatcherHelpers.RunTest(out var dispatcher))
             {
@@ -148,7 +204,31 @@ namespace ReactiveTests.Tests
 
         [TestMethod]
         [Asynchronous]
-        public void ObserveOn_CurrentDispatcher()
+        public void ObserveOnCurrentDispatcher()
+        {
+            using (DispatcherHelpers.RunTest(out var dispatcher))
+            {
+                RunAsync(evt =>
+                {
+                    var okay = true;
+                    dispatcher.BeginInvoke(new Action(() =>
+                    {
+                        Observable.Range(0, 10, NewThreadScheduler.Default).ObserveOnCurrentWpfDispatcher().Subscribe(x =>
+                        {
+                            okay &= (SynchronizationContext.Current is System.Windows.Threading.DispatcherSynchronizationContext);
+                        }, () =>
+                        {
+                            Assert.True(okay);
+                            evt.Set();
+                        });
+                    }));
+                });
+            }
+        }
+
+        [TestMethod]
+        [Asynchronous]
+        public void ObserveOn_CurrentDispatcher_Legacy()
         {
             using (DispatcherHelpers.RunTest(out var dispatcher))
             {
@@ -160,9 +240,43 @@ namespace ReactiveTests.Tests
                         Observable.Range(0, 10, NewThreadScheduler.Default).ObserveOnDispatcher().Subscribe(x =>
                         {
                             okay &= (SynchronizationContext.Current is System.Windows.Threading.DispatcherSynchronizationContext);
-                        },  () =>
+                        }, () =>
+                        {
+                            Assert.True(okay);
+                            evt.Set();
+                        });
+                    }));
+                });
+            }
+        }
+
+
+        [TestMethod]
+        [Asynchronous]
+        public void ObserveOnCurrentDispatcher_Error()
+        {
+            using (DispatcherHelpers.RunTest(out var dispatcher))
+            {
+                RunAsync(evt =>
+                {
+                    var ex = new Exception();
+                    var okay = true;
+
+                    dispatcher.BeginInvoke(new Action(() =>
+                    {
+                        Observable.Throw<int>(ex).ObserveOnCurrentWpfDispatcher().Subscribe(x =>
+                        {
+                            okay &= (SynchronizationContext.Current is System.Windows.Threading.DispatcherSynchronizationContext);
+                        },
+                        e =>
                         {
                             Assert.True(okay);
+                            Assert.Same(ex, e);
+                            evt.Set();
+                        },
+                        () =>
+                        {
+                            Assert.True(false);
                             evt.Set();
                         });
                     }));
@@ -172,7 +286,7 @@ namespace ReactiveTests.Tests
 
         [TestMethod]
         [Asynchronous]
-        public void ObserveOn_Error()
+        public void ObserveOn_Error_Legacy()
         {
             using (DispatcherHelpers.RunTest(out var dispatcher))
             {

+ 152 - 4
Rx.NET/Source/tests/Tests.System.Reactive/Tests/Linq/Observable/SubscribeOnTest.cs

@@ -15,10 +15,14 @@ using System.Windows.Threading;
 using System.Reactive;
 using System.Reactive.Subjects;
 
+using LegacyDispatcherScheduler = System.Reactive.Concurrency.DispatcherScheduler;
+using DispatcherScheduler = System.Reactive.Integration.Wpf.DispatcherScheduler;
 #endif
 
 #if HAS_WINFORMS
 using System.Windows.Forms;
+using LegacyControlScheduler = System.Reactive.Concurrency.ControlScheduler;
+using ControlScheduler = System.Reactive.Integration.WindowsForms.ControlScheduler;
 #endif
 
 using Assert = Xunit.Assert;
@@ -40,7 +44,11 @@ namespace ReactiveTests.Tests
 #pragma warning disable IDE0034 // (Simplify 'default'.) Want to be explicit about overload being tested.
             ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn<int>(default(IObservable<int>), new ControlScheduler(new Label())));
             ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn<int>(someObservable, default(ControlScheduler)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn<int>(default(IObservable<int>), new LegacyControlScheduler(new Label())));
+            ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn<int>(someObservable, default(LegacyControlScheduler)));
 
+            ReactiveAssert.Throws<ArgumentNullException>(() => WindowsFormsControlObservable.SubscribeOnWindowFormsControl<int>(default(IObservable<int>), new Label()));
+            ReactiveAssert.Throws<ArgumentNullException>(() => WindowsFormsControlObservable.SubscribeOnWindowFormsControl<int>(someObservable, default(Label)));
             ReactiveAssert.Throws<ArgumentNullException>(() => ControlObservable.SubscribeOn<int>(default(IObservable<int>), new Label()));
             ReactiveAssert.Throws<ArgumentNullException>(() => ControlObservable.SubscribeOn<int>(someObservable, default(Label)));
 #pragma warning restore IDE0034
@@ -49,7 +57,12 @@ namespace ReactiveTests.Tests
 #pragma warning disable IDE0034 // (Simplify 'default'.) Want to be explicit about overload being tested.
             ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn<int>(default(IObservable<int>), new DispatcherScheduler(Dispatcher.CurrentDispatcher)));
             ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn<int>(someObservable, default(DispatcherScheduler)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn<int>(default(IObservable<int>), new LegacyDispatcherScheduler(Dispatcher.CurrentDispatcher)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn<int>(someObservable, default(LegacyDispatcherScheduler)));
 
+            ReactiveAssert.Throws<ArgumentNullException>(() => WpfDispatcherObservable.SubscribeOnWpfDispatcher<int>(default(IObservable<int>), Dispatcher.CurrentDispatcher));
+            ReactiveAssert.Throws<ArgumentNullException>(() => WpfDispatcherObservable.SubscribeOnWpfDispatcher<int>(someObservable, default(Dispatcher)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => WpfDispatcherObservable.SubscribeOnCurrentWpfDispatcher<int>(default(IObservable<int>)));
             ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherObservable.SubscribeOn<int>(default(IObservable<int>), Dispatcher.CurrentDispatcher));
             ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherObservable.SubscribeOn<int>(someObservable, default(Dispatcher)));
             ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherObservable.SubscribeOnDispatcher<int>(default(IObservable<int>)));
@@ -61,7 +74,7 @@ namespace ReactiveTests.Tests
 
 #if HAS_WINFORMS
         [TestMethod]
-        public void SubscribeOn_Control()
+        public void SubscribeOn_Control_Legacy()
         {
             var okay = true;
 
@@ -94,6 +107,75 @@ namespace ReactiveTests.Tests
             Assert.True(okay);
         }
 
+        [TestMethod]
+        public void SubscribeOnControl()
+        {
+            var okay = true;
+
+            using (WinFormsTestUtils.RunTest(out var lbl))
+            {
+                var evt2 = new ManualResetEvent(false);
+                var evt = new ManualResetEvent(false);
+                var d = Observable.Create<int>(obs =>
+                {
+                    lbl.Text = "Subscribe";
+                    okay &= (SynchronizationContext.Current is System.Windows.Forms.WindowsFormsSynchronizationContext);
+                    evt2.Set();
+
+                    return () =>
+                    {
+                        lbl.Text = "Unsubscribe";
+                        okay &= (SynchronizationContext.Current is System.Windows.Forms.WindowsFormsSynchronizationContext);
+                        evt.Set();
+                    };
+                })
+                .SubscribeOnWindowFormsControl(lbl)
+                .Subscribe(_ => { });
+
+                evt2.WaitOne();
+                d.Dispose();
+
+                evt.WaitOne();
+            }
+
+            Assert.True(okay);
+        }
+
+        [TestMethod]
+        public void SubscribeOn_ControlScheduler_Legacy()
+        {
+            var okay = true;
+
+            using (WinFormsTestUtils.RunTest(out var lbl))
+            {
+                var evt2 = new ManualResetEvent(false);
+                var evt = new ManualResetEvent(false);
+
+                var d = Observable.Create<int>(obs =>
+                {
+                    lbl.Text = "Subscribe";
+                    okay &= (SynchronizationContext.Current is System.Windows.Forms.WindowsFormsSynchronizationContext);
+                    evt2.Set();
+
+                    return () =>
+                    {
+                        lbl.Text = "Unsubscribe";
+                        okay &= (SynchronizationContext.Current is System.Windows.Forms.WindowsFormsSynchronizationContext);
+                        evt.Set();
+                    };
+                })
+                .SubscribeOn(new ControlScheduler(lbl))
+                .Subscribe(_ => { });
+
+                evt2.WaitOne();
+                d.Dispose();
+
+                evt.WaitOne();
+            }
+
+            Assert.True(okay);
+        }
+
         [TestMethod]
         public void SubscribeOn_ControlScheduler()
         {
@@ -117,7 +199,7 @@ namespace ReactiveTests.Tests
                         evt.Set();
                     };
                 })
-                .SubscribeOn(new ControlScheduler(lbl))
+                .SubscribeOn(new System.Reactive.Integration.WindowsForms.ControlScheduler(lbl))
                 .Subscribe(_ => { });
 
                 evt2.WaitOne();
@@ -133,7 +215,7 @@ namespace ReactiveTests.Tests
 #if HAS_DISPATCHER
         [TestMethod]
         [Asynchronous]
-        public void SubscribeOn_Dispatcher()
+        public void SubscribeOn_Dispatcher_Legacy()
         {
             using (DispatcherHelpers.RunTest(out var dispatcher))
             {
@@ -162,6 +244,37 @@ namespace ReactiveTests.Tests
             }
         }
 
+        [TestMethod]
+        [Asynchronous]
+        public void SubscribeOnDispatcher()
+        {
+            using (DispatcherHelpers.RunTest(out var dispatcher))
+            {
+                RunAsync(evt =>
+                {
+                    var s = new AsyncSubject<Unit>();
+                    var okay = true;
+                    var d = Observable.Create<int>(obs =>
+                    {
+                        okay &= (SynchronizationContext.Current is System.Windows.Threading.DispatcherSynchronizationContext);
+                        s.OnNext(Unit.Default);
+                        s.OnCompleted();
+
+                        return () =>
+                        {
+                            okay &= (SynchronizationContext.Current is System.Windows.Threading.DispatcherSynchronizationContext);
+                            Assert.True(okay);
+                            evt.Set();
+                        };
+                    })
+                    .SubscribeOnWpfDispatcher(dispatcher)
+                    .Subscribe(_ => { });
+
+                    s.Subscribe(_ => d.Dispose());
+                });
+            }
+        }
+
         [TestMethod]
         [Asynchronous]
         public void SubscribeOn_DispatcherScheduler()
@@ -195,7 +308,7 @@ namespace ReactiveTests.Tests
 
         [TestMethod]
         [Asynchronous]
-        public void SubscribeOn_CurrentDispatcher()
+        public void SubscribeOn_CurrentDispatcher_Legacy()
         {
             using (DispatcherHelpers.RunTest(out var dispatcher))
             {
@@ -227,6 +340,41 @@ namespace ReactiveTests.Tests
                 });
             }
         }
+
+        [TestMethod]
+        [Asynchronous]
+        public void SubscribeOnCurrentDispatcher()
+        {
+            using (DispatcherHelpers.RunTest(out var dispatcher))
+            {
+                RunAsync(evt =>
+                {
+                    var s = new AsyncSubject<Unit>();
+                    var okay = true;
+
+                    dispatcher.BeginInvoke(new Action(() =>
+                    {
+                        var d = Observable.Create<int>(obs =>
+                        {
+                            okay &= (SynchronizationContext.Current is System.Windows.Threading.DispatcherSynchronizationContext);
+                            s.OnNext(Unit.Default);
+                            s.OnCompleted();
+
+                            return () =>
+                            {
+                                okay &= (SynchronizationContext.Current is System.Windows.Threading.DispatcherSynchronizationContext);
+                                Assert.True(okay);
+                                evt.Set();
+                            };
+                        })
+                        .SubscribeOnCurrentWpfDispatcher()
+                        .Subscribe(_ => { });
+
+                        s.Subscribe(_ => d.Dispose());
+                    }));
+                });
+            }
+        }
 #endif
 
         #endregion + TestBase +

+ 30 - 4
Rx.NET/Source/tests/Tests.System.Reactive/Tests/Linq/QbservableTest.cs

@@ -20,6 +20,15 @@ using Microsoft.Reactive.Testing;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 
 using Assert = Xunit.Assert;
+#if HAS_WINFORMS
+using LegacyControlScheduler = System.Reactive.Concurrency.ControlScheduler;
+using ControlScheduler = System.Reactive.Integration.WindowsForms.ControlScheduler;
+#endif
+
+#if HAS_WPF
+using LegacyDispatcherScheduler = System.Reactive.Concurrency.DispatcherScheduler;
+using DispatcherScheduler = System.Reactive.Integration.Wpf.DispatcherScheduler;
+#endif
 
 namespace ReactiveTests.Tests
 {
@@ -870,12 +879,14 @@ namespace ReactiveTests.Tests
 #endif
 #if HAS_WINFORMS
             ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbMy, default(ControlScheduler)));
+            ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbMy, default(LegacyControlScheduler)));
             ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbNull, new ControlScheduler(new System.Windows.Forms.Form())));
 #endif
             ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbNull, Scheduler.Immediate));
             ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbNull, new SynchronizationContext()));
 #if HAS_DISPATCHER
-            ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbNull, DispatcherScheduler.Instance));
+            ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbNull, DispatcherScheduler.Current));
+            ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbNull, LegacyDispatcherScheduler.Current));
 #endif
         }
 
@@ -885,7 +896,8 @@ namespace ReactiveTests.Tests
         {
             _qbMy.ObserveOn(Scheduler.Immediate);
             _qbMy.ObserveOn(new SynchronizationContext());
-            Qbservable.ObserveOn(_qbMy, DispatcherScheduler.Instance);
+            Qbservable.ObserveOn(_qbMy, DispatcherScheduler.Current);
+            Qbservable.ObserveOn(_qbMy, LegacyDispatcherScheduler.Current);
         }
 #endif
 
@@ -1158,7 +1170,8 @@ namespace ReactiveTests.Tests
             ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbNull, Scheduler.Immediate));
             ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbNull, new SynchronizationContext()));
 #if HAS_DISPATCHER
-            ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbNull, DispatcherScheduler.Instance));
+            ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbNull, DispatcherScheduler.Current));
+            ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbNull, LegacyDispatcherScheduler.Current));
 #endif
 #if HAS_WINFORMS
             ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbMy, default(ControlScheduler)));
@@ -1166,13 +1179,26 @@ namespace ReactiveTests.Tests
 #endif
         }
 
+        [TestMethod]
+        public void SubscribeOn_Legacy()
+        {
+            _qbMy.SubscribeOn(Scheduler.Immediate);
+            _qbMy.SubscribeOn(new SynchronizationContext());
+#if HAS_DISPATCHER
+            Qbservable.SubscribeOn(_qbMy, LegacyDispatcherScheduler.Current);
+#endif
+#if HAS_WINFORMS
+            _qbMy.SubscribeOn(new ControlScheduler(new System.Windows.Forms.Form()));
+#endif
+        }
+
         [TestMethod]
         public void SubscribeOn()
         {
             _qbMy.SubscribeOn(Scheduler.Immediate);
             _qbMy.SubscribeOn(new SynchronizationContext());
 #if HAS_DISPATCHER
-            Qbservable.SubscribeOn(_qbMy, DispatcherScheduler.Instance);
+            Qbservable.SubscribeOn(_qbMy, DispatcherScheduler.Current);
 #endif
 #if HAS_WINFORMS
             _qbMy.SubscribeOn(new ControlScheduler(new System.Windows.Forms.Form()));