1
0
Эх сурвалжийг харах

Merge branch 'master' into VariousBenchmarks

Daniel C. Weber 7 жил өмнө
parent
commit
2c1631f487
50 өөрчлөгдсөн 285 нэмэгдсэн , 257 устгасан
  1. 7 0
      .vsts.ix-shared.yml
  2. 1 1
      Ix.NET/Source/Directory.build.props
  3. 12 0
      Ix.NET/Source/Ix.NET.sln
  4. 3 1
      Ix.NET/Source/System.Interactive/Skip.cs
  5. 33 0
      Ix.NET/Source/System.Interactive/System.Interactive.csproj
  6. 3 1
      Ix.NET/Source/System.Interactive/Take.cs
  7. 26 0
      Ix.NET/Source/refs/System.Interactive/System.Interactive.csproj
  8. 17 17
      Rx.NET/Source/System.Reactive.sln
  9. 2 0
      Rx.NET/Source/benchmarks/Benchmarks.System.Reactive/AppendPrependBenchmark.cs
  10. 22 0
      Rx.NET/Source/benchmarks/Benchmarks.System.Reactive/Benchmarks.System.Reactive.csproj
  11. 6 0
      Rx.NET/Source/benchmarks/Benchmarks.System.Reactive/Program.cs
  12. 0 3
      Rx.NET/Source/src/AssemblyInfo.cs
  13. 2 4
      Rx.NET/Source/src/System.Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.cs
  14. 5 3
      Rx.NET/Source/src/System.Reactive/Concurrency/LocalScheduler.cs
  15. 10 17
      Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Services.Emulation.cs
  16. 2 2
      Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Services.cs
  17. 1 3
      Rx.NET/Source/src/System.Reactive/Concurrency/Synchronization.Synchronize.cs
  18. 2 4
      Rx.NET/Source/src/System.Reactive/Concurrency/ThreadPoolScheduler.cs
  19. 1 1
      Rx.NET/Source/src/System.Reactive/Concurrency/VirtualTimeScheduler.cs
  20. 1 1
      Rx.NET/Source/src/System.Reactive/ExperimentalAttribute.cs
  21. 2 4
      Rx.NET/Source/src/System.Reactive/Internal/SafeObserver.cs
  22. 5 2
      Rx.NET/Source/src/System.Reactive/Internal/ScheduledObserver.cs
  23. 27 31
      Rx.NET/Source/src/System.Reactive/Internal/TailRecursiveSink.cs
  24. 5 7
      Rx.NET/Source/src/System.Reactive/Linq/GroupedObservable.cs
  25. 1 1
      Rx.NET/Source/src/System.Reactive/Linq/LocalQueryMethodImplementationTypeAttribute.cs
  26. 15 21
      Rx.NET/Source/src/System.Reactive/Linq/Observable/AppendPrepend.cs
  27. 0 7
      Rx.NET/Source/src/System.Reactive/Linq/Observable/CombineLatest.cs
  28. 1 1
      Rx.NET/Source/src/System.Reactive/Linq/Observable/FromEventPattern.cs
  29. 3 5
      Rx.NET/Source/src/System.Reactive/Linq/Observable/PushToPullAdapter.cs
  30. 8 36
      Rx.NET/Source/src/System.Reactive/Linq/Observable/SelectMany.cs
  31. 2 4
      Rx.NET/Source/src/System.Reactive/Linq/Observable/Skip.cs
  32. 2 4
      Rx.NET/Source/src/System.Reactive/Linq/Observable/SkipUntil.cs
  33. 4 8
      Rx.NET/Source/src/System.Reactive/Linq/Observable/Take.cs
  34. 4 8
      Rx.NET/Source/src/System.Reactive/Linq/Observable/TakeLast.cs
  35. 2 4
      Rx.NET/Source/src/System.Reactive/Linq/Observable/TakeUntil.cs
  36. 0 5
      Rx.NET/Source/src/System.Reactive/Linq/Observable/Zip.cs
  37. 6 10
      Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Async.cs
  38. 2 4
      Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Events.cs
  39. 2 1
      Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Single.cs
  40. 1 2
      Rx.NET/Source/src/System.Reactive/Notification.cs
  41. 0 1
      Rx.NET/Source/src/System.Reactive/ObservableBase.cs
  42. 4 5
      Rx.NET/Source/src/System.Reactive/ObservableQuery.cs
  43. 2 4
      Rx.NET/Source/src/System.Reactive/Observer.Extensions.cs
  44. 5 7
      Rx.NET/Source/src/System.Reactive/Runtime/CompilerServices/TaskObservableMethodBuilder.cs
  45. 5 6
      Rx.NET/Source/src/System.Reactive/Subjects/BehaviorSubject.cs
  46. 2 1
      Rx.NET/Source/src/System.Reactive/Subjects/ReplaySubject.cs
  47. 2 4
      Rx.NET/Source/src/System.Reactive/Threading/Tasks/TaskObservableExtensions.cs
  48. 2 2
      Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Core.approved.txt
  49. 2 4
      Rx.NET/Source/tests/Tests.System.Reactive/Tests/LicenseHeaderTest.cs
  50. 13 0
      Rx.NET/Source/tests/Tests.System.Reactive/Tests/Linq/Observable/ObserveOnTest.cs

+ 7 - 0
.vsts.ix-shared.yml

@@ -14,6 +14,13 @@ steps:
   displayName: Set Version
   condition: eq(variables['system.pullrequest.isfork'], false)
 
+- task: DotNetCoreCLI@2
+  inputs:
+    command: build
+    projects: Ix.NET/Source/refs/**/System.Interactive*.csproj
+    arguments: -c $(BuildConfiguration)   
+  displayName: Build reference assemblies
+
 - task: DotNetCoreCLI@2
   inputs:
     command: pack

+ 1 - 1
Ix.NET/Source/Directory.build.props

@@ -12,7 +12,7 @@
     <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>    
     <SignAssembly>true</SignAssembly>
     <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)ReactiveX.snk</AssemblyOriginatorKeyFile>
-    <NoWarn>$(NoWarn);1701;1702;CS1591</NoWarn>
+    <NoWarn>$(NoWarn);1701;1702;CS1591;NU5105</NoWarn>
     <DefaultLanguage>en-US</DefaultLanguage>
     <IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>
     <DebugType>embedded</DebugType>

+ 12 - 0
Ix.NET/Source/Ix.NET.sln

@@ -7,6 +7,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{87534290
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B733D97A-F1ED-4FC3-BF8E-9AC47A89DE96}"
 	ProjectSection(SolutionItems) = preProject
+		..\..\.vsts.ix-ci.yml = ..\..\.vsts.ix-ci.yml
+		..\..\.vsts.ix-pr.yml = ..\..\.vsts.ix-pr.yml
+		..\..\.vsts.ix-shared.yml = ..\..\.vsts.ix-shared.yml
 		CodeCoverage.runsettings = CodeCoverage.runsettings
 		Directory.build.props = Directory.build.props
 		Directory.build.targets = Directory.build.targets
@@ -25,6 +28,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Interactive.Tests",
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Interactive.Async.Tests", "System.Interactive.Async.Tests\System.Interactive.Async.Tests.csproj", "{172BD8C4-5C3E-4928-9D3F-746CF336FFEC}"
 EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Refs", "Refs", "{A3D72E6E-4ADA-42E0-8B2A-055B1F244281}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Interactive", "refs\System.Interactive\System.Interactive.csproj", "{2EC0C302-B029-4DDB-AC91-000BF11006AD}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -55,6 +62,10 @@ Global
 		{172BD8C4-5C3E-4928-9D3F-746CF336FFEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{172BD8C4-5C3E-4928-9D3F-746CF336FFEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{172BD8C4-5C3E-4928-9D3F-746CF336FFEC}.Release|Any CPU.Build.0 = Release|Any CPU
+		{2EC0C302-B029-4DDB-AC91-000BF11006AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{2EC0C302-B029-4DDB-AC91-000BF11006AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{2EC0C302-B029-4DDB-AC91-000BF11006AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{2EC0C302-B029-4DDB-AC91-000BF11006AD}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -62,6 +73,7 @@ Global
 	GlobalSection(NestedProjects) = preSolution
 		{AFD2E6EC-C5B0-4276-A14A-467D786D0DDA} = {87534290-A7A6-47A4-9A3A-D0D21A9AD1D4}
 		{172BD8C4-5C3E-4928-9D3F-746CF336FFEC} = {87534290-A7A6-47A4-9A3A-D0D21A9AD1D4}
+		{2EC0C302-B029-4DDB-AC91-000BF11006AD} = {A3D72E6E-4ADA-42E0-8B2A-055B1F244281}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {9B5F6126-CBBA-4C3A-A3BB-26AFE56DABEC}

+ 3 - 1
Ix.NET/Source/System.Interactive/Skip.cs

@@ -8,6 +8,7 @@ namespace System.Linq
 {
     public static partial class EnumerableEx
     {
+#if !(REF_ASSM && NETCOREAPP2_0)
         /// <summary>
         ///     Bypasses a specified number of contiguous elements from the end of the sequence and returns the remaining elements.
         /// </summary>
@@ -32,6 +33,7 @@ namespace System.Linq
 
             return source.SkipLast_(count);
         }
+#endif
 
         private static IEnumerable<TSource> SkipLast_<TSource>(this IEnumerable<TSource> source, int count)
         {
@@ -47,4 +49,4 @@ namespace System.Linq
             }
         }
     }
-}
+}

+ 33 - 0
Ix.NET/Source/System.Interactive/System.Interactive.csproj

@@ -12,4 +12,37 @@
     <EmbeddedResource Include="Properties\System.Interactive.rd.xml" />
   </ItemGroup>
 
+  <PropertyGroup>
+    <TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);GetRefs</TargetsForTfmSpecificContentInPackage>
+  </PropertyGroup>
+
+
+  <Target Name="GetRefs">
+
+    <MSBuild Projects="..\refs\System.Interactive\System.Interactive.csproj" 
+             Targets="_GetReferenceAssemblies" 
+             Properties="TargetFramework=$(TargetFramework)">
+
+      <Output TaskParameter="TargetOutputs" ItemName="_refAssms" />
+    </MSBuild>
+
+    <ItemGroup>
+      <TfmSpecificPackageFile Include="@(_refAssms)" PackagePath="ref/$(TargetFramework)" />
+    </ItemGroup>
+  </Target>
+
+  <Target Name="GetRefsWithoutLib" BeforeTargets="_GetPackageFiles">
+    <MSBuild Projects="..\refs\System.Interactive\System.Interactive.csproj"
+             Targets="_GetReferenceAssemblies"
+             Properties="TargetFramework=netcoreapp2.0">
+
+      <Output TaskParameter="TargetOutputs" ItemName="_refAssms20" />
+    </MSBuild>
+
+    <ItemGroup>
+      <None Include="@(_refAssms20)" PackagePath="ref/netcoreapp2.0" Pack="true" />
+    </ItemGroup>
+
+  </Target>
+  
 </Project>

+ 3 - 1
Ix.NET/Source/System.Interactive/Take.cs

@@ -8,6 +8,7 @@ namespace System.Linq
 {
     public static partial class EnumerableEx
     {
+#if !(REF_ASSM && NETCOREAPP2_0)
         /// <summary>
         ///     Returns a specified number of contiguous elements from the end of the sequence.
         /// </summary>
@@ -29,6 +30,7 @@ namespace System.Linq
 
             return source.TakeLast_(count);
         }
+#endif
 
         private static IEnumerable<TSource> TakeLast_<TSource>(this IEnumerable<TSource> source, int count)
         {
@@ -55,4 +57,4 @@ namespace System.Linq
             }
         }
     }
-}
+}

+ 26 - 0
Ix.NET/Source/refs/System.Interactive/System.Interactive.csproj

@@ -0,0 +1,26 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <Description>Interactive Extensions Main Library used to express queries over enumerable sequences.</Description>
+    <AssemblyTitle>Interactive Extensions - Main Library</AssemblyTitle>
+    <Authors>Microsoft</Authors>
+    <TargetFrameworks>net45;netstandard1.0;netstandard2.0;netcoreapp2.0</TargetFrameworks>
+    <PackageTags>Ix;Interactive;Extensions;Enumerable</PackageTags>
+    <DefineConstants>$(DefineConstants);REF_ASSM</DefineConstants>
+    <ProduceReferenceAssembly>true</ProduceReferenceAssembly>
+    <Deterministic>true</Deterministic>
+    <IsPackable>false</IsPackable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Compile Include="..\..\System.Interactive\**\*.cs" Exclude="..\..\System.Interactive\obj\**" />
+  </ItemGroup>
+
+  <Target Name="_GetReferenceAssemblies" DependsOnTargets="Build" Returns="@(ReferenceAssembliesOutput)">
+    <ItemGroup>
+      <ReferenceAssembliesOutput Include="@(IntermediateRefAssembly->'%(FullPath)')" />
+      <ReferenceAssembliesOutput Include="@(DocumentationProjectOutputGroupOutput->'%(FullPath)')" />
+    </ItemGroup>
+  </Target>
+
+</Project>

+ 17 - 17
Rx.NET/Source/System.Reactive.sln

@@ -56,7 +56,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Reactive.Interfaces"
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.System.Reactive.ApiApprovals", "tests\Tests.System.Reactive.ApiApprovals\Tests.System.Reactive.ApiApprovals.csproj", "{01CCDA6D-4D00-4DF2-82B0-359FD5E0CDC6}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmarks.System.Reactive", "benchmarks\Benchmarks.System.Reactive\Benchmarks.System.Reactive.csproj", "{5C7906F6-232E-455C-9269-68EF84F393C9}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmarks.System.Reactive", "benchmarks\Benchmarks.System.Reactive\Benchmarks.System.Reactive.csproj", "{5C7906F6-232E-455C-9269-68EF84F393C9}"
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Benchmarks", "Benchmarks", "{C8E480ED-B592-4341-A0C9-183E822EB6B9}"
 EndProject
@@ -334,22 +334,22 @@ Global
 		{01CCDA6D-4D00-4DF2-82B0-359FD5E0CDC6}.Release|x64.Build.0 = Release|Any CPU
 		{01CCDA6D-4D00-4DF2-82B0-359FD5E0CDC6}.Release|x86.ActiveCfg = Release|Any CPU
 		{01CCDA6D-4D00-4DF2-82B0-359FD5E0CDC6}.Release|x86.Build.0 = Release|Any CPU
-		{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|ARM.ActiveCfg = Debug|Any CPU
-		{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|ARM.Build.0 = Debug|Any CPU
-		{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|x64.Build.0 = Debug|Any CPU
-		{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|x86.Build.0 = Debug|Any CPU
-		{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|Any CPU.Build.0 = Release|Any CPU
-		{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|ARM.ActiveCfg = Release|Any CPU
-		{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|ARM.Build.0 = Release|Any CPU
-		{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|x64.ActiveCfg = Release|Any CPU
-		{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|x64.Build.0 = Release|Any CPU
-		{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|x86.ActiveCfg = Release|Any CPU
-		{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|x86.Build.0 = Release|Any CPU
+		{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|Any CPU.ActiveCfg = Current Sources|Any CPU
+		{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|Any CPU.Build.0 = Current Sources|Any CPU
+		{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|ARM.ActiveCfg = Rx.net 4.0|Any CPU
+		{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|ARM.Build.0 = Rx.net 4.0|Any CPU
+		{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|x64.ActiveCfg = Rx.net 4.0|Any CPU
+		{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|x64.Build.0 = Rx.net 4.0|Any CPU
+		{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|x86.ActiveCfg = Rx.net 4.0|Any CPU
+		{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|x86.Build.0 = Rx.net 4.0|Any CPU
+		{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|Any CPU.ActiveCfg = Rx.net 4.0|Any CPU
+		{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|Any CPU.Build.0 = Rx.net 4.0|Any CPU
+		{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|ARM.ActiveCfg = Rx.net 4.0|Any CPU
+		{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|ARM.Build.0 = Rx.net 4.0|Any CPU
+		{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|x64.ActiveCfg = Rx.net 4.0|Any CPU
+		{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
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 2 - 0
Rx.NET/Source/benchmarks/Benchmarks.System.Reactive/AppendPrependBenchmark.cs

@@ -2,6 +2,7 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information.
 
+#if (CURRENT)
 using System;
 using System.Collections.Generic;
 using System.Reactive.Linq;
@@ -85,3 +86,4 @@ namespace Benchmarks.System.Reactive
         }
     }
 }
+#endif

+ 22 - 0
Rx.NET/Source/benchmarks/Benchmarks.System.Reactive/Benchmarks.System.Reactive.csproj

@@ -3,6 +3,20 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework>net46</TargetFramework>
+    <Optimize>true</Optimize>
+    <Configurations>Current Sources;Rx.net 3.1.1;Rx.net 4.0</Configurations>
+  </PropertyGroup>
+
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Rx.net 3.1.1|AnyCPU'">
+    <DefineConstants>$(DefineConstants);RX3_1_1</DefineConstants>
+  </PropertyGroup>
+
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Rx.net 4.0|AnyCPU'">
+    <DefineConstants>$(DefineConstants);RX4_0</DefineConstants>
+  </PropertyGroup>
+
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Current Sources|AnyCPU'">
+    <DefineConstants>$(DefineConstants);CURRENT</DefineConstants>
   </PropertyGroup>
 
   <ItemGroup>
@@ -10,6 +24,14 @@
     <PackageReference Include="WindowsBase" Version="4.6.1055" />
   </ItemGroup>
 
+  <ItemGroup Condition="'$(Configuration)|$(Platform)'=='Rx.net 3.1.1|AnyCPU'">
+    <PackageReference Include="System.Reactive" Version="3.1.1" />
+  </ItemGroup>
+
+  <ItemGroup Condition="'$(Configuration)|$(Platform)'=='Rx.net 4.0|AnyCPU'">
+    <PackageReference Include="System.Reactive" Version="4.0.0" />
+  </ItemGroup>
+
   <ItemGroup>
     <ProjectReference Include="..\..\tests\Tests.System.Reactive\Tests.System.Reactive.csproj" />
   </ItemGroup>

+ 6 - 0
Rx.NET/Source/benchmarks/Benchmarks.System.Reactive/Program.cs

@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 using System;
+using System.Reactive.Linq;
 using BenchmarkDotNet.Running;
 
 namespace Benchmarks.System.Reactive
@@ -11,6 +12,8 @@ namespace Benchmarks.System.Reactive
     {
         private static void Main()
         {
+            Console.WriteLine("Effective Rx-version: " + typeof(Observable).Assembly.GetName().Version);
+
             var switcher = new BenchmarkSwitcher(new[] {
                 typeof(ZipBenchmark),
                 typeof(CombineLatestBenchmark),
@@ -22,6 +25,9 @@ namespace Benchmarks.System.Reactive
                 typeof(AppendPrependBenchmark),
                 typeof(ComparisonBenchmark),
                 typeof(ComparisonAsyncBenchmark)
+#if (CURRENT)
+                ,typeof(AppendPrependBenchmark)
+#endif
             });
 
             switcher.Run();

+ 0 - 3
Rx.NET/Source/src/AssemblyInfo.cs

@@ -1,9 +1,6 @@
 using System;
 using System.Resources;
 using System.Runtime.InteropServices;
-using System.Security;
-
-
 
 [assembly: ComVisible(false)]
 [assembly: CLSCompliant(true)]

+ 2 - 4
Rx.NET/Source/src/System.Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.cs

@@ -44,10 +44,8 @@ namespace System.Reactive.Concurrency
             {
                 return new FastPeriodicTimer(action);
             }
-            else
-            {
-                return new PeriodicTimer(action, period);
-            }
+
+            return new PeriodicTimer(action, period);
         }
 
         public IDisposable QueueUserWorkItem(Action<object> action, object state)

+ 5 - 3
Rx.NET/Source/src/System.Reactive/Concurrency/LocalScheduler.cs

@@ -84,13 +84,15 @@ namespace System.Reactive.Concurrency
         {
             if (serviceType == typeof(IStopwatchProvider))
             {
-                return this as IStopwatchProvider;
+                return this;
             }
-            else if (serviceType == typeof(ISchedulerLongRunning))
+
+            if (serviceType == typeof(ISchedulerLongRunning))
             {
                 return this as ISchedulerLongRunning;
             }
-            else if (serviceType == typeof(ISchedulerPeriodic))
+
+            if (serviceType == typeof(ISchedulerPeriodic))
             {
                 return this as ISchedulerPeriodic;
             }

+ 10 - 17
Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Services.Emulation.cs

@@ -396,8 +396,6 @@ namespace System.Reactive.Concurrency
 
                 while (true)
                 {
-                    var shouldWaitForResume = false;
-
                     lock (_gate)
                     {
                         if (_runState == RUNNING)
@@ -411,7 +409,8 @@ namespace System.Reactive.Concurrency
                             next = Normalize(_nextDue - (_stopwatch.Elapsed - _inactiveTime));
                             break;
                         }
-                        else if (_runState == DISPOSED)
+
+                        if (_runState == DISPOSED)
                         {
                             //
                             // In case the periodic job gets disposed but we are currently
@@ -422,16 +421,13 @@ namespace System.Reactive.Concurrency
                             //
                             return;
                         }
-                        else
-                        {
-                            //
-                            // This is the least common case where we got suspended and need
-                            // to block such that future reevaluations of the next due time
-                            // will pick up the cumulative inactive time delta.
-                            //
-                            Debug.Assert(_runState == SUSPENDED);
-                            shouldWaitForResume = true;
-                        }
+
+                        //
+                        // This is the least common case where we got suspended and need
+                        // to block such that future reevaluations of the next due time
+                        // will pick up the cumulative inactive time delta.
+                        //
+                        Debug.Assert(_runState == SUSPENDED);
                     }
 
                     //
@@ -441,10 +437,7 @@ namespace System.Reactive.Concurrency
                     // be extremely unlucky to find ourselves SUSPENDED again and be blocked
                     // once more.
                     //
-                    if (shouldWaitForResume)
-                    {
-                        _resumeEvent.WaitOne();
-                    }
+                    _resumeEvent.WaitOne();
                 }
 
                 recurse(this, next);

+ 2 - 2
Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Services.cs

@@ -10,10 +10,10 @@ namespace System.Reactive.Concurrency
     //
     public static partial class Scheduler
     {
-        internal static Type[] OPTIMIZATIONS = new Type[] {
+        internal static Type[] OPTIMIZATIONS = {
             typeof(ISchedulerLongRunning),
             typeof(IStopwatchProvider),
-            typeof(ISchedulerPeriodic),
+            typeof(ISchedulerPeriodic)
             /* update this list if new interface-based optimizations are added */
         };
 

+ 1 - 3
Rx.NET/Source/src/System.Reactive/Concurrency/Synchronization.Synchronize.cs

@@ -27,14 +27,12 @@ namespace System.Reactive.Concurrency
 
         internal sealed class _ : IdentitySink<TSource>
         {
-            private readonly Synchronize<TSource> _parent;
             private readonly object _gate;
 
             public _(Synchronize<TSource> parent, IObserver<TSource> observer)
                 : base(observer)
             {
-                _parent = parent;
-                _gate = _parent._gate ?? new object();
+                _gate = parent._gate ?? new object();
             }
 
             public override void OnNext(TSource value)

+ 2 - 4
Rx.NET/Source/src/System.Reactive/Concurrency/ThreadPoolScheduler.cs

@@ -141,10 +141,8 @@ namespace System.Reactive.Concurrency
             {
                 return new FastPeriodicTimer<TState>(state, action);
             }
-            else
-            {
-                return new PeriodicTimer<TState>(state, period, action);
-            }
+
+            return new PeriodicTimer<TState>(state, period, action);
         }
 
         private sealed class FastPeriodicTimer<TState> : IDisposable

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

@@ -320,7 +320,7 @@ namespace System.Reactive.Concurrency
         {
             if (serviceType == typeof(IStopwatchProvider))
             {
-                return this as IStopwatchProvider;
+                return this;
             }
 
             return null;

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

@@ -7,7 +7,7 @@ namespace System.Reactive
     /// <summary>
     /// Marks the program elements that are experimental. This class cannot be inherited.
     /// </summary>
-    [Experimental, AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]
+    [Experimental, AttributeUsage(AttributeTargets.All)]
     public sealed class ExperimentalAttribute : Attribute
     {
     }

+ 2 - 4
Rx.NET/Source/src/System.Reactive/Internal/SafeObserver.cs

@@ -62,10 +62,8 @@ namespace System.Reactive
             {
                 return a.MakeSafe();
             }
-            else
-            {
-                return new WrappingSafeObserver(observer);
-            }
+
+            return new WrappingSafeObserver(observer);
         }
 
         private IDisposable _disposable;

+ 5 - 2
Rx.NET/Source/src/System.Reactive/Internal/ScheduledObserver.cs

@@ -536,7 +536,10 @@ namespace System.Reactive
 
             if (Interlocked.Decrement(ref _wip) != 0)
             {
-                return recursiveScheduler.Schedule(this, DRAIN_SHORT_RUNNING);
+                // Don't return the disposable of Schedule() because that may chain together
+                // a long string of ScheduledItems causing StackOverflowException upon Dispose()
+                var d = recursiveScheduler.Schedule(this, DRAIN_SHORT_RUNNING);
+                Disposable.TrySetMultiple(ref _task, d);
             }
             return Disposable.Empty;
         }
@@ -602,7 +605,7 @@ namespace System.Reactive
                 }
                 return true;
             }
-            else
+            
             // the queue is empty and the upstream hasn't completed yet
             if (empty)
             {

+ 27 - 31
Rx.NET/Source/src/System.Reactive/Internal/TailRecursiveSink.cs

@@ -109,44 +109,40 @@ namespace System.Reactive
                                     _stack.Push(nextEnumerator);
                                     continue;
                                 }
-                                else
-                                {
-                                    Volatile.Write(ref _isDisposed, true);
-                                    continue;
-                                }
+
+                                Volatile.Write(ref _isDisposed, true);
+                                continue;
                             }
-                            else
-                            {
-                                // we need an unique indicator for this as
-                                // Subscribe could return a Disposable.Empty or
-                                // a BooleanDisposable
-                                var sad = ReadyToken.Ready;
 
-                                // Swap in the Ready indicator so we know the sequence hasn't been disposed
-                                if (Disposable.TrySetSingle(ref _currentSubscription, sad) == TrySetSingleResult.Success)
-                                {
-                                    // subscribe to the source
-                                    var d = next.SubscribeSafe(this);
+                            // we need an unique indicator for this as
+                            // Subscribe could return a Disposable.Empty or
+                            // a BooleanDisposable
+                            var sad = ReadyToken.Ready;
 
-                                    // Try to swap in the returned disposable in place of the Ready indicator
-                                    // Since this drain loop is the only one to use Ready, this should
-                                    // be unambiguous
-                                    var u = Interlocked.CompareExchange(ref _currentSubscription, d, sad);
+                            // Swap in the Ready indicator so we know the sequence hasn't been disposed
+                            if (Disposable.TrySetSingle(ref _currentSubscription, sad) == TrySetSingleResult.Success)
+                            {
+                                // subscribe to the source
+                                var d = next.SubscribeSafe(this);
 
-                                    // sequence disposed or completed synchronously
-                                    if (u != sad)
+                                // Try to swap in the returned disposable in place of the Ready indicator
+                                // Since this drain loop is the only one to use Ready, this should
+                                // be unambiguous
+                                var u = Interlocked.CompareExchange(ref _currentSubscription, d, sad);
+
+                                // sequence disposed or completed synchronously
+                                if (u != sad)
+                                {
+                                    d.Dispose();
+                                    if (u == BooleanDisposable.True)
                                     {
-                                        d.Dispose();
-                                        if (u == BooleanDisposable.True)
-                                        {
-                                            continue;
-                                        }
+                                        continue;
                                     }
                                 }
-                                else
-                                {
-                                    continue;
-                                }
+                            }
+                            else
+                            {
+                                continue;
                             }
                         }
                         else

+ 5 - 7
Rx.NET/Source/src/System.Reactive/Linq/GroupedObservable.cs

@@ -38,13 +38,11 @@ namespace System.Reactive.Linq
                 var subscription = _subject.Subscribe/*Unsafe*/(observer);
                 return StableCompositeDisposable.Create(release, subscription);
             }
-            else
-            {
-                //
-                // [OK] Use of unsafe Subscribe: called on a known subject implementation.
-                //
-                return _subject.Subscribe/*Unsafe*/(observer);
-            }
+
+            //
+            // [OK] Use of unsafe Subscribe: called on a known subject implementation.
+            //
+            return _subject.Subscribe/*Unsafe*/(observer);
         }
     }
 }

+ 1 - 1
Rx.NET/Source/src/System.Reactive/Linq/LocalQueryMethodImplementationTypeAttribute.cs

@@ -12,7 +12,7 @@ namespace System.Reactive.Linq
     /// target class type.
     /// </summary>
     [EditorBrowsable(EditorBrowsableState.Never)]
-    [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
+    [AttributeUsage(AttributeTargets.Class, Inherited = false)]
     public sealed class LocalQueryMethodImplementationTypeAttribute : Attribute
     {
         private readonly Type _targetType;

+ 15 - 21
Rx.NET/Source/src/System.Reactive/Linq/Observable/AppendPrepend.cs

@@ -41,11 +41,9 @@ namespace System.Reactive.Linq.ObservableImpl
                     return new AppendPrependMultiple<TSource>(_source,
                         null, new Node<TSource>(prev, value), Scheduler);
                 }
-                else
-                {
-                    return new AppendPrependMultiple<TSource>(_source,
-                        prev, new Node<TSource>(value), Scheduler);
-                }
+
+                return new AppendPrependMultiple<TSource>(_source,
+                    prev, new Node<TSource>(value), Scheduler);
             }
 
             public IAppendPrepend<TSource> Prepend(TSource value)
@@ -57,11 +55,9 @@ namespace System.Reactive.Linq.ObservableImpl
                     return new AppendPrependMultiple<TSource>(_source,
                         new Node<TSource>(value), prev, Scheduler);
                 }
-                else
-                {
-                    return new AppendPrependMultiple<TSource>(_source,
-                        new Node<TSource>(prev, value), null, Scheduler);
-                }
+
+                return new AppendPrependMultiple<TSource>(_source,
+                    new Node<TSource>(prev, value), null, Scheduler);
             }
 
             protected override _ CreateSink(IObserver<TSource> observer) => new _(this, observer);
@@ -239,17 +235,15 @@ namespace System.Reactive.Linq.ObservableImpl
                         //
                         return longRunning.ScheduleLongRunning(new State(null, this, array, continueWith), Loop);
                     }
-                    else
-                    {
-                        //
-                        // We never allow the scheduled work to be cancelled. Instead, the flag
-                        // is used to have LoopRec bail out and perform proper clean-up of the
-                        // enumerator.
-                        //
-                        var flag = new BooleanDisposable();
-                        _scheduler.Schedule(new State(flag, this, array, continueWith), LoopRec);
-                        return flag;
-                    }
+
+                    //
+                    // We never allow the scheduled work to be cancelled. Instead, the flag
+                    // is used to have LoopRec bail out and perform proper clean-up of the
+                    // enumerator.
+                    //
+                    var flag = new BooleanDisposable();
+                    _scheduler.Schedule(new State(flag, this, array, continueWith), LoopRec);
+                    return flag;
                 }
 
                 private struct State

+ 0 - 7
Rx.NET/Source/src/System.Reactive/Linq/Observable/CombineLatest.cs

@@ -108,7 +108,6 @@ namespace System.Reactive.Linq.ObservableImpl
                         else if (_other.Done)
                         {
                             _parent.ForwardOnCompleted();
-                            return;
                         }
                     }
                 }
@@ -130,7 +129,6 @@ namespace System.Reactive.Linq.ObservableImpl
                         if (_other.Done)
                         {
                             _parent.ForwardOnCompleted();
-                            return;
                         }
                         else
                         {
@@ -181,7 +179,6 @@ namespace System.Reactive.Linq.ObservableImpl
                         else if (_other.Done)
                         {
                             _parent.ForwardOnCompleted();
-                            return;
                         }
                     }
                 }
@@ -203,7 +200,6 @@ namespace System.Reactive.Linq.ObservableImpl
                         if (_other.Done)
                         {
                             _parent.ForwardOnCompleted();
-                            return;
                         }
                         else
                         {
@@ -323,7 +319,6 @@ namespace System.Reactive.Linq.ObservableImpl
             if (allDone)
             {
                 ForwardOnCompleted();
-                return;
             }
         }
     }
@@ -472,7 +467,6 @@ namespace System.Reactive.Linq.ObservableImpl
                     else if (_isDone.AllExcept(index))
                     {
                         ForwardOnCompleted();
-                        return;
                     }
                 }
             }
@@ -494,7 +488,6 @@ namespace System.Reactive.Linq.ObservableImpl
                     if (_isDone.All())
                     {
                         ForwardOnCompleted();
-                        return;
                     }
                     else
                     {

+ 1 - 1
Rx.NET/Source/src/System.Reactive/Linq/Observable/FromEventPattern.cs

@@ -151,7 +151,7 @@ namespace System.Reactive.Linq.ObservableImpl
             private Action AddHandlerCoreWinRT(Delegate handler)
             {
                 var token = _addMethod.Invoke(_target, new object[] { handler });
-                return () => _removeMethod.Invoke(_target, new object[] { token });
+                return () => _removeMethod.Invoke(_target, new[] { token });
             }
 #endif
         }

+ 3 - 5
Rx.NET/Source/src/System.Reactive/Linq/Observable/PushToPullAdapter.cs

@@ -50,11 +50,9 @@ namespace System.Reactive.Linq.ObservableImpl
                     Current = current;
                     return true;
                 }
-                else
-                {
-                    _done = true;
-                    Dispose();
-                }
+
+                _done = true;
+                Dispose();
             }
 
             return false;

+ 8 - 36
Rx.NET/Source/src/System.Reactive/Linq/Observable/SelectMany.cs

@@ -392,12 +392,12 @@ namespace System.Reactive.Linq.ObservableImpl
                         return;
                     }
 
-                    try
+                    using (e)
                     {
                         var hasNext = true;
+
                         while (hasNext)
                         {
-                            hasNext = false;
                             var current = default(TResult);
 
                             try
@@ -420,13 +420,6 @@ namespace System.Reactive.Linq.ObservableImpl
                             }
                         }
                     }
-                    finally
-                    {
-                        if (e != null)
-                        {
-                            e.Dispose();
-                        }
-                    }
                 }
             }
         }
@@ -488,13 +481,13 @@ namespace System.Reactive.Linq.ObservableImpl
                         return;
                     }
 
-                    try
+                    using (e)
                     {
                         var eIndex = 0;
                         var hasNext = true;
+
                         while (hasNext)
                         {
-                            hasNext = false;
                             var current = default(TResult);
 
                             try
@@ -517,13 +510,6 @@ namespace System.Reactive.Linq.ObservableImpl
                             }
                         }
                     }
-                    finally
-                    {
-                        if (e != null)
-                        {
-                            e.Dispose();
-                        }
-                    }
                 }
             }
         }
@@ -1367,12 +1353,12 @@ namespace System.Reactive.Linq.ObservableImpl
                         return;
                     }
 
-                    try
+                    using (e)
                     {
                         var hasNext = true;
+
                         while (hasNext)
                         {
-                            hasNext = false;
                             var current = default(TResult);
 
                             try
@@ -1395,13 +1381,6 @@ namespace System.Reactive.Linq.ObservableImpl
                             }
                         }
                     }
-                    finally
-                    {
-                        if (e != null)
-                        {
-                            e.Dispose();
-                        }
-                    }
                 }
             }
         }
@@ -1457,12 +1436,12 @@ namespace System.Reactive.Linq.ObservableImpl
                         return;
                     }
 
-                    try
+                    using (e)
                     {
                         var hasNext = true;
+
                         while (hasNext)
                         {
-                            hasNext = false;
                             var current = default(TResult);
 
                             try
@@ -1485,13 +1464,6 @@ namespace System.Reactive.Linq.ObservableImpl
                             }
                         }
                     }
-                    finally
-                    {
-                        if (e != null)
-                        {
-                            e.Dispose();
-                        }
-                    }
                 }
             }
         }

+ 2 - 4
Rx.NET/Source/src/System.Reactive/Linq/Observable/Skip.cs

@@ -88,10 +88,8 @@ namespace System.Reactive.Linq.ObservableImpl
                 {
                     return this;
                 }
-                else
-                {
-                    return new Time(_source, duration, _scheduler);
-                }
+
+                return new Time(_source, duration, _scheduler);
             }
 
             protected override _ CreateSink(IObserver<TSource> observer) => new _(observer);

+ 2 - 4
Rx.NET/Source/src/System.Reactive/Linq/Observable/SkipUntil.cs

@@ -147,10 +147,8 @@ namespace System.Reactive.Linq.ObservableImpl
             {
                 return this;
             }
-            else
-            {
-                return new SkipUntil<TSource>(_source, startTime, _scheduler);
-            }
+
+            return new SkipUntil<TSource>(_source, startTime, _scheduler);
         }
 
         protected override _ CreateSink(IObserver<TSource> observer) => new _(observer);

+ 4 - 8
Rx.NET/Source/src/System.Reactive/Linq/Observable/Take.cs

@@ -33,10 +33,8 @@ namespace System.Reactive.Linq.ObservableImpl
                 {
                     return this;
                 }
-                else
-                {
-                    return new Count(_source, count);
-                }
+
+                return new Count(_source, count);
             }
 
             protected override _ CreateSink(IObserver<TSource> observer) => new _(_count, observer);
@@ -97,10 +95,8 @@ namespace System.Reactive.Linq.ObservableImpl
                 {
                     return this;
                 }
-                else
-                {
-                    return new Time(_source, duration, _scheduler);
-                }
+
+                return new Time(_source, duration, _scheduler);
             }
 
             protected override _ CreateSink(IObserver<TSource> observer) => new _(observer);

+ 4 - 8
Rx.NET/Source/src/System.Reactive/Linq/Observable/TakeLast.cs

@@ -106,10 +106,8 @@ namespace System.Reactive.Linq.ObservableImpl
                             ForwardOnCompleted();
                             break;
                         }
-                        else
-                        {
-                            ForwardOnNext(_queue.Dequeue());
-                        }
+
+                        ForwardOnNext(_queue.Dequeue());
 
                         n--;
                     }
@@ -223,10 +221,8 @@ namespace System.Reactive.Linq.ObservableImpl
                             ForwardOnCompleted();
                             break;
                         }
-                        else
-                        {
-                            ForwardOnNext(_queue.Dequeue().Value);
-                        }
+
+                        ForwardOnNext(_queue.Dequeue().Value);
 
                         n--;
                     }

+ 2 - 4
Rx.NET/Source/src/System.Reactive/Linq/Observable/TakeUntil.cs

@@ -124,10 +124,8 @@ namespace System.Reactive.Linq.ObservableImpl
             {
                 return this;
             }
-            else
-            {
-                return new TakeUntil<TSource>(_source, endTime, _scheduler);
-            }
+
+            return new TakeUntil<TSource>(_source, endTime, _scheduler);
         }
 
         protected override _ CreateSink(IObserver<TSource> observer) => new _(observer);

+ 0 - 5
Rx.NET/Source/src/System.Reactive/Linq/Observable/Zip.cs

@@ -149,7 +149,6 @@ namespace System.Reactive.Linq.ObservableImpl
                             if (_other.Done)
                             {
                                 _parent.ForwardOnCompleted();
-                                return;
                             }
                             else
                             {
@@ -232,7 +231,6 @@ namespace System.Reactive.Linq.ObservableImpl
                             if (_other.Done)
                             {
                                 _parent.ForwardOnCompleted();
-                                return;
                             }
                             else
                             {
@@ -471,7 +469,6 @@ namespace System.Reactive.Linq.ObservableImpl
             if (allDone)
             {
                 ForwardOnCompleted();
-                return;
             }
         }
     }
@@ -642,7 +639,6 @@ namespace System.Reactive.Linq.ObservableImpl
                     else if (_isDone.AllExcept(index))
                     {
                         ForwardOnCompleted();
-                        return;
                     }
                 }
             }
@@ -664,7 +660,6 @@ namespace System.Reactive.Linq.ObservableImpl
                     if (_isDone.All())
                     {
                         ForwardOnCompleted();
-                        return;
                     }
                     else
                     {

+ 6 - 10
Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Async.cs

@@ -684,10 +684,8 @@ namespace System.Reactive.Linq
             {
                 return task.ToObservable(scheduler);
             }
-            else
-            {
-                return task.ToObservable();
-            }
+            
+            return task.ToObservable();
         }
 
         public virtual IObservable<TSource> StartAsync<TSource>(Func<CancellationToken, Task<TSource>> functionAsync)
@@ -789,10 +787,8 @@ namespace System.Reactive.Linq
             {
                 return task.ToObservable(scheduler);
             }
-            else
-            {
-                return task.ToObservable();
-            }
+            
+            return task.ToObservable();
         }
 
         public virtual IObservable<Unit> StartAsync(Func<CancellationToken, Task> actionAsync)
@@ -929,7 +925,7 @@ namespace System.Reactive.Linq
 
         public virtual Func<T, IObservable<TResult>> ToAsync<T, TResult>(Func<T, TResult> function, IScheduler scheduler)
         {
-            return (first) =>
+            return first =>
             {
                 var subject = new AsyncSubject<TResult>();
                 scheduler.ScheduleAction((function, subject, first), state =>
@@ -1426,7 +1422,7 @@ namespace System.Reactive.Linq
 
         public virtual Func<TSource, IObservable<Unit>> ToAsync<TSource>(Action<TSource> action, IScheduler scheduler)
         {
-            return (first) =>
+            return first =>
             {
                 var subject = new AsyncSubject<Unit>();
                 scheduler.ScheduleAction((subject, action, first), state =>

+ 2 - 4
Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Events.cs

@@ -368,10 +368,8 @@ namespace System.Reactive.Linq
             {
                 return new SynchronizationContextScheduler(context, false);
             }
-            else
-            {
-                return SchedulerDefaults.ConstantTimeOperations;
-            }
+
+            return SchedulerDefaults.ConstantTimeOperations;
         }
 
         #endregion

+ 2 - 1
Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Single.cs

@@ -63,7 +63,8 @@ namespace System.Reactive.Linq
             {
                 return new Buffer<TSource>.CountOverlap(source, count, skip);
             }
-            else if (count < skip)
+
+            if (count < skip)
             {
                 return new Buffer<TSource>.CountSkip(source, count, skip);
             }

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

@@ -6,7 +6,6 @@ using System.Collections.Generic;
 using System.Diagnostics;
 using System.Globalization;
 using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
 
 #pragma warning disable 0659
 #pragma warning disable 0661
@@ -31,7 +30,7 @@ namespace System.Reactive
         /// <summary>
         /// Represents an OnCompleted notification.
         /// </summary>
-        OnCompleted,
+        OnCompleted
     }
 
     /// <summary>

+ 0 - 1
Rx.NET/Source/src/System.Reactive/ObservableBase.cs

@@ -3,7 +3,6 @@
 // See the LICENSE file in the project root for more information. 
 
 using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
 
 namespace System.Reactive
 {

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

@@ -177,10 +177,8 @@ namespace System.Reactive
                     {
                         return Expression.Constant(source);
                     }
-                    else
-                    {
-                        return Visit(query.Expression);
-                    }
+
+                    return Visit(query.Expression);
                 }
 
                 return node;
@@ -208,7 +206,8 @@ namespace System.Reactive
                         var then = Expression.Call(pattern, "Then", method.GetGenericArguments(), arguments);
                         return then;
                     }
-                    else if (method.Name == "And")
+
+                    if (method.Name == "And")
                     {
                         //
                         // Retarget And to the corresponding pattern.

+ 2 - 4
Rx.NET/Source/src/System.Reactive/Observer.Extensions.cs

@@ -226,10 +226,8 @@ namespace System.Reactive
             {
                 return new AsyncLockObserver<T>(observer, new AsyncLock());
             }
-            else
-            {
-                return new SynchronizedObserver<T>(observer, new object());
-            }
+
+            return new SynchronizedObserver<T>(observer, new object());
         }
 
         /// <summary>

+ 5 - 7
Rx.NET/Source/src/System.Reactive/Runtime/CompilerServices/TaskObservableMethodBuilder.cs

@@ -5,7 +5,6 @@
 using System.Reactive;
 using System.Reactive.Concurrency;
 using System.Reactive.Disposables;
-using System.Reactive.Linq;
 using System.Reactive.Subjects;
 using System.Security;
 
@@ -296,16 +295,15 @@ namespace System.Runtime.CompilerServices
                 {
                     return _subject.Subscribe(observer);
                 }
-                else if (_exception != null)
+
+                if (_exception != null)
                 {
                     observer.OnError(_exception);
                     return Disposable.Empty;
                 }
-                else
-                {
-                    observer.OnNext(_result);
-                    return Disposable.Empty;
-                }
+
+                observer.OnNext(_result);
+                return Disposable.Empty;
             }
 
             /// <summary>

+ 5 - 6
Rx.NET/Source/src/System.Reactive/Subjects/BehaviorSubject.cs

@@ -118,15 +118,14 @@ namespace System.Reactive.Subjects
                     value = default;
                     return false;
                 }
-                else if (_exception != null)
+
+                if (_exception != null)
                 {
                     throw _exception;
                 }
-                else
-                {
-                    value = _value;
-                    return true;
-                }
+
+                value = _value;
+                return true;
             }
         }
 

+ 2 - 1
Rx.NET/Source/src/System.Reactive/Subjects/ReplaySubject.cs

@@ -880,7 +880,8 @@ namespace System.Reactive.Subjects
                             observer.OnError(error);
                             break;
                         }
-                        else if (done)
+
+                        if (done)
                         {
                             var observer = Done();
                             observer.OnCompleted();

+ 2 - 4
Rx.NET/Source/src/System.Reactive/Threading/Tasks/TaskObservableExtensions.cs

@@ -246,10 +246,8 @@ namespace System.Reactive.Threading.Tasks
             {
                 return subject.ObserveOn(scheduler);
             }
-            else
-            {
-                return subject.AsObservable();
-            }
+
+            return subject.AsObservable();
         }
 
         /// <summary>

+ 2 - 2
Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Core.approved.txt

@@ -58,7 +58,7 @@ namespace System.Reactive
         protected void Add(System.Delegate handler, System.Action<TSender, TEventArgs> invoke) { }
         protected void Remove(System.Delegate handler) { }
     }
-    [System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Module | System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Event | System.AttributeTargets.Interface | System.AttributeTargets.Parameter | System.AttributeTargets.Delegate | System.AttributeTargets.ReturnValue | System.AttributeTargets.GenericParameter | System.AttributeTargets.All, AllowMultiple=false, Inherited=true)]
+    [System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Module | System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Event | System.AttributeTargets.Interface | System.AttributeTargets.Parameter | System.AttributeTargets.Delegate | System.AttributeTargets.ReturnValue | System.AttributeTargets.GenericParameter | System.AttributeTargets.All)]
     [System.Reactive.ExperimentalAttribute()]
     public sealed class ExperimentalAttribute : System.Attribute
     {
@@ -825,7 +825,7 @@ namespace System.Reactive.Linq
     {
         System.Reactive.Linq.IQbservable<TResult> CreateQuery<TResult>(System.Linq.Expressions.Expression expression);
     }
-    [System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.All, AllowMultiple=false, Inherited=false)]
+    [System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.All, Inherited=false)]
     public sealed class LocalQueryMethodImplementationTypeAttribute : System.Attribute
     {
         public LocalQueryMethodImplementationTypeAttribute(System.Type targetType) { }

+ 2 - 4
Rx.NET/Source/tests/Tests.System.Reactive/Tests/LicenseHeaderTest.cs

@@ -48,14 +48,12 @@ namespace Tests.System.Reactive.Tests
             foreach (var file in Directory.EnumerateFiles(path, "*.cs", SearchOption.AllDirectories))
             {
                 // exclusions
-                if (file.Contains("obj/Debug")
-                    || file.Contains(@"obj\Debug")
+                if (file.Contains("/obj/")
+                    || file.Contains(@"\obj\")
                     || file.Contains("AssemblyInfo.cs")
                     || file.Contains(".Designer.cs")
                     || file.Contains(".Generated.cs")
                     || file.Contains("Uwp.DeviceRunner")
-                    || file.Contains(@"obj\Release")
-                    || file.Contains("obj/Release")
                 )
                 {
                     continue;

+ 13 - 0
Rx.NET/Source/tests/Tests.System.Reactive/Tests/Linq/Observable/ObserveOnTest.cs

@@ -645,6 +645,19 @@ namespace ReactiveTests.Tests
             );
         }
 
+        [Fact]
+        public void ObserveOn_EventLoop_Long()
+        {
+            var _scheduler1 = new EventLoopScheduler();
+            var N = 1_000_000;
+
+            var cde = new CountdownEvent(1);
+
+            Observable.Range(1, N).ObserveOn(_scheduler1)
+                .Subscribe(v => { }, () => cde.Signal());
+
+            Assert.True(cde.Wait(5000), "Timeout!");
+        }
     }
 
     internal class MyCtx : SynchronizationContext