Bläddra i källkod

#nullable enable for joins and platform code.

Bart De Smet 5 år sedan
förälder
incheckning
7a1cdc164b
26 ändrade filer med 46 tillägg och 97 borttagningar
  1. 1 2
      Rx.NET/Source/src/System.Reactive/Joins/ActivePlan.cs
  2. 6 7
      Rx.NET/Source/src/System.Reactive/Joins/JoinObserver.cs
  3. 1 3
      Rx.NET/Source/src/System.Reactive/Joins/Pattern.Generated.cs
  4. 0 2
      Rx.NET/Source/src/System.Reactive/Joins/Pattern.cs
  5. 0 2
      Rx.NET/Source/src/System.Reactive/Joins/Pattern.tt
  6. 16 18
      Rx.NET/Source/src/System.Reactive/Joins/Plan.cs
  7. 1 3
      Rx.NET/Source/src/System.Reactive/Joins/QueryablePattern.Generated.cs
  8. 0 2
      Rx.NET/Source/src/System.Reactive/Joins/QueryablePattern.cs
  9. 0 2
      Rx.NET/Source/src/System.Reactive/Joins/QueryablePattern.tt
  10. 0 2
      Rx.NET/Source/src/System.Reactive/Joins/QueryablePlan.cs
  11. 2 4
      Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Concurrency/ControlScheduler.cs
  12. 2 4
      Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Concurrency/DispatcherScheduler.cs
  13. 0 2
      Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/ControlObservable.cs
  14. 0 2
      Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/DispatcherObservable.cs
  15. 0 2
      Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/Observable.Remoting.cs
  16. 4 6
      Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/QueryLanguage.Remoting.cs
  17. 2 5
      Rx.NET/Source/src/System.Reactive/Platforms/UWP/Concurrency/CoreDispatcherScheduler.cs
  18. 1 3
      Rx.NET/Source/src/System.Reactive/Platforms/UWP/EventPatternSource.cs
  19. 2 4
      Rx.NET/Source/src/System.Reactive/Platforms/UWP/Foundation/AsyncInfoExtensions.cs
  20. 4 6
      Rx.NET/Source/src/System.Reactive/Platforms/UWP/Foundation/AsyncInfoToObservableBridge.cs
  21. 1 3
      Rx.NET/Source/src/System.Reactive/Platforms/UWP/IEventPatternSource.cs
  22. 0 2
      Rx.NET/Source/src/System.Reactive/Platforms/UWP/Linq/AsyncInfoObservable.cs
  23. 0 2
      Rx.NET/Source/src/System.Reactive/Platforms/UWP/Linq/CoreDispatcherObservable.cs
  24. 0 2
      Rx.NET/Source/src/System.Reactive/Platforms/UWP/Linq/WindowsObservable.Events.cs
  25. 1 3
      Rx.NET/Source/src/System.Reactive/Platforms/UWP/Linq/WindowsObservable.StandardSequenceOperators.cs
  26. 2 4
      Rx.NET/Source/src/System.Reactive/Platforms/Windows/ThreadPoolTimerExtensions.cs

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

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 using System.Collections.Generic;
 
 namespace System.Reactive.Joins
@@ -20,6 +18,7 @@ namespace System.Reactive.Joins
         {
             _onCompleted = onCompleted;
         }
+
         protected void AddJoinObserver(IJoinObserver joinObserver)
         {
             if (!_joinObservers.ContainsKey(joinObserver))

+ 6 - 7
Rx.NET/Source/src/System.Reactive/Joins/JoinObserver.cs

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 using System.Collections.Generic;
 using System.Reactive.Disposables;
 using System.Reactive.Linq;
@@ -18,12 +16,11 @@ namespace System.Reactive.Joins
 
     internal sealed class JoinObserver<T> : ObserverBase<Notification<T>>, IJoinObserver
     {
-        private object _gate;
+        private object? _gate;
         private readonly IObservable<T> _source;
         private readonly Action<Exception> _onError;
         private readonly List<ActivePlan> _activePlans;
-        public Queue<Notification<T>> Queue { get; }
-        private IDisposable _subscription;
+        private IDisposable? _subscription;
         private bool _isDisposed;
 
         public JoinObserver(IObservable<T> source, Action<Exception> onError)
@@ -34,6 +31,8 @@ namespace System.Reactive.Joins
             _activePlans = new List<ActivePlan>();
         }
 
+        public Queue<Notification<T>> Queue { get; }
+
         public void AddActivePlan(ActivePlan activePlan)
         {
             _activePlans.Add(activePlan);
@@ -52,13 +51,13 @@ namespace System.Reactive.Joins
 
         protected override void OnNextCore(Notification<T> notification)
         {
-            lock (_gate)
+            lock (_gate!) // NB: Called after Subscribe(object) is called.
             {
                 if (!_isDisposed)
                 {
                     if (notification.Kind == NotificationKind.OnError)
                     {
-                        _onError(notification.Exception);
+                        _onError(notification.Exception!);
                         return;
                     }
 

+ 1 - 3
Rx.NET/Source/src/System.Reactive/Joins/Pattern.Generated.cs

@@ -2,13 +2,11 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 namespace System.Reactive.Joins
 {
     /* The following code is generated by a T4 template. */
 
-    #region Joins auto-generated code (09/25/2020 12:58:51)
+    #region Joins auto-generated code (10/01/2020 12:41:25)
 
     /// <summary>
     /// Represents a join pattern over one observable sequence.

+ 0 - 2
Rx.NET/Source/src/System.Reactive/Joins/Pattern.cs

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 namespace System.Reactive.Joins
 {
     /// <summary>

+ 0 - 2
Rx.NET/Source/src/System.Reactive/Joins/Pattern.tt

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 <#@ template debug="false" hostspecific="false" language="C#" #>
 <#@ assembly name="System.Core" #>
 <#@ import namespace="System.Linq" #>

+ 16 - 18
Rx.NET/Source/src/System.Reactive/Joins/Plan.cs

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 using System.Collections.Generic;
 
 namespace System.Reactive.Joins
@@ -57,7 +55,7 @@ namespace System.Reactive.Joins
         {
             var onError = new Action<Exception>(observer.OnError);
             var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
-            var activePlan = default(ActivePlan<T1>);
+            var activePlan = default(ActivePlan<T1>)!;
 
             activePlan = new ActivePlan<T1>(firstJoinObserver,
                 first =>
@@ -103,7 +101,7 @@ namespace System.Reactive.Joins
             var onError = new Action<Exception>(observer.OnError);
             var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
             var secondJoinObserver = CreateObserver(externalSubscriptions, Expression.Second, onError);
-            var activePlan = default(ActivePlan<T1, T2>);
+            var activePlan = default(ActivePlan<T1, T2>)!;
 
             activePlan = new ActivePlan<T1, T2>(firstJoinObserver, secondJoinObserver,
                 (first, second) =>
@@ -153,7 +151,7 @@ namespace System.Reactive.Joins
             var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
             var secondJoinObserver = CreateObserver(externalSubscriptions, Expression.Second, onError);
             var thirdJoinObserver = CreateObserver(externalSubscriptions, Expression.Third, onError);
-            var activePlan = default(ActivePlan<T1, T2, T3>);
+            var activePlan = default(ActivePlan<T1, T2, T3>)!;
 
             activePlan = new ActivePlan<T1, T2, T3>(firstJoinObserver, secondJoinObserver, thirdJoinObserver,
                 (first, second, third) =>
@@ -206,7 +204,7 @@ namespace System.Reactive.Joins
             var secondJoinObserver = CreateObserver(externalSubscriptions, Expression.Second, onError);
             var thirdJoinObserver = CreateObserver(externalSubscriptions, Expression.Third, onError);
             var fourthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourth, onError);
-            var activePlan = default(ActivePlan<T1, T2, T3, T4>);
+            var activePlan = default(ActivePlan<T1, T2, T3, T4>)!;
 
             activePlan = new ActivePlan<T1, T2, T3, T4>(firstJoinObserver, secondJoinObserver, thirdJoinObserver, fourthJoinObserver,
                 (first, second, third, fourth) =>
@@ -262,7 +260,7 @@ namespace System.Reactive.Joins
             var thirdJoinObserver = CreateObserver(externalSubscriptions, Expression.Third, onError);
             var fourthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourth, onError);
             var fifthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifth, onError);
-            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5>);
+            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5>)!;
 
             activePlan = new ActivePlan<T1, T2, T3, T4, T5>(firstJoinObserver, secondJoinObserver, thirdJoinObserver, fourthJoinObserver, fifthJoinObserver,
                 (first, second, third, fourth, fifth) =>
@@ -321,7 +319,7 @@ namespace System.Reactive.Joins
             var fourthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourth, onError);
             var fifthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifth, onError);
             var sixthJoinObserver = CreateObserver(externalSubscriptions, Expression.Sixth, onError);
-            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6>);
+            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6>)!;
 
             activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6>(firstJoinObserver, secondJoinObserver, thirdJoinObserver,
                 fourthJoinObserver, fifthJoinObserver, sixthJoinObserver,
@@ -384,7 +382,7 @@ namespace System.Reactive.Joins
             var fifthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifth, onError);
             var sixthJoinObserver = CreateObserver(externalSubscriptions, Expression.Sixth, onError);
             var seventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Seventh, onError);
-            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7>);
+            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7>)!;
 
             activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7>(firstJoinObserver, secondJoinObserver, thirdJoinObserver,
                 fourthJoinObserver, fifthJoinObserver, sixthJoinObserver, seventhJoinObserver,
@@ -450,7 +448,7 @@ namespace System.Reactive.Joins
             var sixthJoinObserver = CreateObserver(externalSubscriptions, Expression.Sixth, onError);
             var seventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Seventh, onError);
             var eighthJoinObserver = CreateObserver(externalSubscriptions, Expression.Eighth, onError);
-            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8>);
+            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8>)!;
 
             activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8>(firstJoinObserver, secondJoinObserver, thirdJoinObserver,
                 fourthJoinObserver, fifthJoinObserver, sixthJoinObserver, seventhJoinObserver, eighthJoinObserver,
@@ -519,7 +517,7 @@ namespace System.Reactive.Joins
             var seventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Seventh, onError);
             var eighthJoinObserver = CreateObserver(externalSubscriptions, Expression.Eighth, onError);
             var ninthJoinObserver = CreateObserver(externalSubscriptions, Expression.Ninth, onError);
-            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9>);
+            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9>)!;
 
             activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9>(firstJoinObserver, secondJoinObserver, thirdJoinObserver,
                 fourthJoinObserver, fifthJoinObserver, sixthJoinObserver, seventhJoinObserver, eighthJoinObserver, ninthJoinObserver,
@@ -591,7 +589,7 @@ namespace System.Reactive.Joins
             var eighthJoinObserver = CreateObserver(externalSubscriptions, Expression.Eighth, onError);
             var ninthJoinObserver = CreateObserver(externalSubscriptions, Expression.Ninth, onError);
             var tenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Tenth, onError);
-            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>);
+            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>)!;
 
             activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(firstJoinObserver, secondJoinObserver, thirdJoinObserver,
                 fourthJoinObserver, fifthJoinObserver, sixthJoinObserver, seventhJoinObserver, eighthJoinObserver, ninthJoinObserver, tenthJoinObserver,
@@ -667,7 +665,7 @@ namespace System.Reactive.Joins
             var tenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Tenth, onError);
             var eleventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Eleventh, onError);
 
-            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>);
+            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>)!;
 
             activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(firstJoinObserver, secondJoinObserver, thirdJoinObserver,
                 fourthJoinObserver, fifthJoinObserver, sixthJoinObserver, seventhJoinObserver, eighthJoinObserver, ninthJoinObserver, tenthJoinObserver, eleventhJoinObserver,
@@ -746,7 +744,7 @@ namespace System.Reactive.Joins
             var eleventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Eleventh, onError);
             var twelfthJoinObserver = CreateObserver(externalSubscriptions, Expression.Twelfth, onError);
 
-            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>);
+            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>)!;
 
             activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(firstJoinObserver, secondJoinObserver, thirdJoinObserver,
                 fourthJoinObserver, fifthJoinObserver, sixthJoinObserver, seventhJoinObserver, eighthJoinObserver, ninthJoinObserver, tenthJoinObserver, eleventhJoinObserver,
@@ -830,7 +828,7 @@ namespace System.Reactive.Joins
             var twelfthJoinObserver = CreateObserver(externalSubscriptions, Expression.Twelfth, onError);
             var thirteenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Thirteenth, onError);
 
-            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>);
+            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>)!;
 
             activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(firstJoinObserver, secondJoinObserver, thirdJoinObserver,
                 fourthJoinObserver, fifthJoinObserver, sixthJoinObserver, seventhJoinObserver, eighthJoinObserver, ninthJoinObserver, tenthJoinObserver, eleventhJoinObserver,
@@ -917,7 +915,7 @@ namespace System.Reactive.Joins
             var thirteenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Thirteenth, onError);
             var fourteenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourteenth, onError);
 
-            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>);
+            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>)!;
 
             activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(
                 firstJoinObserver, secondJoinObserver, thirdJoinObserver,
@@ -1010,7 +1008,7 @@ namespace System.Reactive.Joins
             var fourteenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourteenth, onError);
             var fifteenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifteenth, onError);
 
-            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>);
+            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>)!;
 
             activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(
                 firstJoinObserver, secondJoinObserver, thirdJoinObserver,
@@ -1105,7 +1103,7 @@ namespace System.Reactive.Joins
             var fifteenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifteenth, onError);
             var sixteenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Sixteenth, onError);
 
-            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>);
+            var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>)!;
 
             activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(
                 firstJoinObserver, secondJoinObserver, thirdJoinObserver,

+ 1 - 3
Rx.NET/Source/src/System.Reactive/Joins/QueryablePattern.Generated.cs

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 using System.Linq.Expressions;
 using System.Reactive.Linq;
 
@@ -11,7 +9,7 @@ namespace System.Reactive.Joins
 {
     /* The following code is generated by a T4 template. */
 
-    #region Joins auto-generated code (09/25/2020 13:10:21)
+    #region Joins auto-generated code (10/01/2020 12:41:16)
 
     /// <summary>
     /// Represents a join pattern over two observable sequences.

+ 0 - 2
Rx.NET/Source/src/System.Reactive/Joins/QueryablePattern.cs

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 using System.Linq.Expressions;
 
 namespace System.Reactive.Joins

+ 0 - 2
Rx.NET/Source/src/System.Reactive/Joins/QueryablePattern.tt

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 <#@ template debug="false" hostspecific="false" language="C#" #>
 <#@ assembly name="System.Core" #>
 <#@ import namespace="System.Linq" #>

+ 0 - 2
Rx.NET/Source/src/System.Reactive/Joins/QueryablePlan.cs

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 using System.Linq.Expressions;
 
 namespace System.Reactive.Joins

+ 2 - 4
Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Concurrency/ControlScheduler.cs

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 using System.Reactive.Disposables;
 using System.Threading;
 using System.Windows.Forms;
@@ -114,7 +112,7 @@ namespace System.Reactive.Concurrency
                         finally
                         {
                             t.Stop();
-                            action = null;
+                            action = static (s, t) => Disposable.Empty;
                         }
                     }
                 };
@@ -128,7 +126,7 @@ namespace System.Reactive.Concurrency
                     if (t != null)
                     {
                         t.Stop();
-                        action = static (_, __) => Disposable.Empty;
+                        action = static (s, t) => Disposable.Empty;
                     }
                 });
 

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

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 #if HAS_WPF
 using System.Reactive.Disposables;
 using System.Threading;
@@ -149,7 +147,7 @@ namespace System.Reactive.Concurrency
                     finally
                     {
                         t.Stop();
-                        action = null;
+                        action = static (s, t) => Disposable.Empty;
                     }
                 }
             };
@@ -163,7 +161,7 @@ namespace System.Reactive.Concurrency
                 if (t != null)
                 {
                     t.Stop();
-                    action = static (_, __) => Disposable.Empty;
+                    action = static (s, t) => Disposable.Empty;
                 }
             });
 

+ 0 - 2
Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/ControlObservable.cs

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 using System.Reactive.Concurrency;
 using System.Windows.Forms;
 

+ 0 - 2
Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/DispatcherObservable.cs

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 #if HAS_WPF
 using System.Reactive.Concurrency;
 using System.Windows.Threading;

+ 0 - 2
Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/Observable.Remoting.cs

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 #if HAS_REMOTING
 using System.Linq.Expressions;
 using System.Reflection;

+ 4 - 6
Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/QueryLanguage.Remoting.cs

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 #if HAS_REMOTING
 using System.Reactive.Disposables;
 using System.Runtime.Remoting;
@@ -70,7 +68,7 @@ namespace System.Reactive.Linq
             return new SerializableObservable<TSource>(new RemotableObservable<TSource>(source, null));
         }
 
-        private static IObservable<TSource> Remotable_<TSource>(IObservable<TSource> source, ILease lease)
+        private static IObservable<TSource> Remotable_<TSource>(IObservable<TSource> source, ILease? lease)
         {
             return new SerializableObservable<TSource>(new RemotableObservable<TSource>(source, lease));
         }
@@ -167,9 +165,9 @@ namespace System.Reactive.Linq
         private sealed class RemotableObservable<T> : MarshalByRefObject, IObservable<T>
         {
             private readonly IObservable<T> _underlyingObservable;
-            private readonly ILease _lease;
+            private readonly ILease? _lease;
 
-            public RemotableObservable(IObservable<T> underlyingObservable, ILease lease)
+            public RemotableObservable(IObservable<T> underlyingObservable, ILease? lease)
             {
                 _underlyingObservable = underlyingObservable;
                 _lease = lease;
@@ -184,7 +182,7 @@ namespace System.Reactive.Linq
             }
 
             [SecurityCritical]
-            public override object InitializeLifetimeService()
+            public override object? InitializeLifetimeService()
             {
                 return _lease;
             }

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

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 #if WINDOWS
 using System.Reactive.Disposables;
 using System.Runtime.ExceptionServices;
@@ -186,7 +184,6 @@ namespace System.Reactive.Concurrency
         {
             var d = new MultipleAssignmentDisposable();
 
-
             var timer = CreateDispatcherQueue().CreateTimer();
 
             timer.Tick += (o, e) =>
@@ -201,7 +198,7 @@ namespace System.Reactive.Concurrency
                     finally
                     {
                         t.Stop();
-                        action = null;
+                        action = static (s, t) => Disposable.Empty;
                     }
                 }
             };
@@ -215,7 +212,7 @@ namespace System.Reactive.Concurrency
                 if (t != null)
                 {
                     t.Stop();
-                    action = static (_, __) => Disposable.Empty;
+                    action = static (s, t) => Disposable.Empty;
                 }
             });
 

+ 1 - 3
Rx.NET/Source/src/System.Reactive/Platforms/UWP/EventPatternSource.cs

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 #if HAS_WINRT
 using Windows.Foundation;
 
@@ -30,4 +28,4 @@ namespace System.Reactive
         }
     }
 }
-#endif
+#endif

+ 2 - 4
Rx.NET/Source/src/System.Reactive/Platforms/UWP/Foundation/AsyncInfoExtensions.cs

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 #if HAS_WINRT
 using System.Reactive.Linq;
 using Windows.Foundation;
@@ -107,7 +105,7 @@ namespace System.Reactive.Windows.Foundation
             });
         }
 
-        private static IObservable<Unit> ToObservable_<TProgress>(this IAsyncActionWithProgress<TProgress> source, IProgress<TProgress> progress)
+        private static IObservable<Unit> ToObservable_<TProgress>(this IAsyncActionWithProgress<TProgress> source, IProgress<TProgress>? progress)
         {
             return new AsyncInfoToObservableBridge<Unit, TProgress>(
                 source,
@@ -262,7 +260,7 @@ namespace System.Reactive.Windows.Foundation
             return source.ToObservable_(progress, true);
         }
 
-        private static IObservable<TResult> ToObservable_<TResult, TProgress>(this IAsyncOperationWithProgress<TResult, TProgress> source, IProgress<TProgress> progress, bool supportsMultiple)
+        private static IObservable<TResult> ToObservable_<TResult, TProgress>(this IAsyncOperationWithProgress<TResult, TProgress> source, IProgress<TProgress>? progress, bool supportsMultiple)
         {
             return new AsyncInfoToObservableBridge<TResult, TProgress>(
                 source,

+ 4 - 6
Rx.NET/Source/src/System.Reactive/Platforms/UWP/Foundation/AsyncInfoToObservableBridge.cs

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 #if HAS_WINRT
 using System.Reactive.Subjects;
 using Windows.Foundation;
@@ -16,7 +14,7 @@ namespace System.Reactive.Windows.Foundation
         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)
+        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;
@@ -78,7 +76,7 @@ namespace System.Reactive.Windows.Foundation
             //
             // 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 _getResults is merely
+            // 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.
             //
@@ -96,7 +94,7 @@ namespace System.Reactive.Windows.Foundation
             {
                 if (_getResult != null)
                 {
-                    _subject.OnNext(result);
+                    _subject.OnNext(result!); // NB: Has been assigned in switch statement above.
                 }
 
                 _subject.OnCompleted();
@@ -109,4 +107,4 @@ namespace System.Reactive.Windows.Foundation
         }
     }
 }
-#endif
+#endif

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

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 #if HAS_WINRT
 using Windows.Foundation;
 
@@ -23,4 +21,4 @@ namespace System.Reactive
         event TypedEventHandler<TSender, TEventArgs> OnNext;
     }
 }
-#endif
+#endif

+ 0 - 2
Rx.NET/Source/src/System.Reactive/Platforms/UWP/Linq/AsyncInfoObservable.cs

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 #if HAS_WINRT
 using System.Reactive.Disposables;
 using System.Reactive.Threading.Tasks;

+ 0 - 2
Rx.NET/Source/src/System.Reactive/Platforms/UWP/Linq/CoreDispatcherObservable.cs

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 #if WINDOWS
 using System.Reactive.Concurrency;
 using Windows.UI.Core;

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

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 #if HAS_WINRT
 using Windows.Foundation;
 

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

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 #if HAS_WINRT
 using System.Reactive.Windows.Foundation;
 using Windows.Foundation;
@@ -129,4 +127,4 @@ namespace System.Reactive.Linq
         }
     }
 }
-#endif
+#endif

+ 2 - 4
Rx.NET/Source/src/System.Reactive/Platforms/Windows/ThreadPoolTimerExtensions.cs

@@ -2,8 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT License.
 // See the LICENSE file in the project root for more information. 
 
-#nullable disable
-
 #if WINDOWS
 using System.Reactive.Disposables;
 using Windows.System.Threading;
@@ -15,12 +13,12 @@ namespace System.Reactive.Concurrency
     {
         public static IDisposable AsDisposable(this ThreadPoolTimer threadPoolTimer)
         {
-            return Disposable.Create(threadPoolTimer, static _ => _.Cancel());
+            return Disposable.Create(threadPoolTimer, static t => t!.Cancel());
         }
 
         public static IDisposable AsDisposable(this IAsyncInfo asyncInfo)
         {
-            return Disposable.Create(asyncInfo, static _ => _.Cancel());
+            return Disposable.Create(asyncInfo, static i => i!.Cancel());
         }
     }
 }