diff --git a/Rx.NET/Source/src/System.Reactive/Disposables/CancellationDisposable.cs b/Rx.NET/Source/src/System.Reactive/Disposables/CancellationDisposable.cs index f4381903ef..353a263ab9 100644 --- a/Rx.NET/Source/src/System.Reactive/Disposables/CancellationDisposable.cs +++ b/Rx.NET/Source/src/System.Reactive/Disposables/CancellationDisposable.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.Threading; namespace System.Reactive.Disposables diff --git a/Rx.NET/Source/src/System.Reactive/Disposables/ContextDisposable.cs b/Rx.NET/Source/src/System.Reactive/Disposables/ContextDisposable.cs index 4e5b0dac3e..49812ce7d5 100644 --- a/Rx.NET/Source/src/System.Reactive/Disposables/ContextDisposable.cs +++ b/Rx.NET/Source/src/System.Reactive/Disposables/ContextDisposable.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.Threading; diff --git a/Rx.NET/Source/src/System.Reactive/Disposables/MultipleAssignmentDisposable.cs b/Rx.NET/Source/src/System.Reactive/Disposables/MultipleAssignmentDisposable.cs index 0e57f48b9a..335e501212 100644 --- a/Rx.NET/Source/src/System.Reactive/Disposables/MultipleAssignmentDisposable.cs +++ b/Rx.NET/Source/src/System.Reactive/Disposables/MultipleAssignmentDisposable.cs @@ -2,9 +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.Disposables { /// @@ -12,7 +9,7 @@ namespace System.Reactive.Disposables /// public sealed class MultipleAssignmentDisposable : ICancelable { - private IDisposable _current; + private IDisposable? _current; /// /// Initializes a new instance of the class with no current underlying disposable. @@ -30,7 +27,7 @@ public MultipleAssignmentDisposable() /// Gets or sets the underlying disposable. After disposal, the result of getting this property is undefined. /// /// If the has already been disposed, assignment to this property causes immediate disposal of the given disposable object. - public IDisposable Disposable + public IDisposable? Disposable { get => Disposables.Disposable.GetValueOrDefault(ref _current); set => Disposables.Disposable.TrySetMultiple(ref _current, value); diff --git a/Rx.NET/Source/src/System.Reactive/Disposables/RefCountDisposable.cs b/Rx.NET/Source/src/System.Reactive/Disposables/RefCountDisposable.cs index 9369d75227..3ed932267d 100644 --- a/Rx.NET/Source/src/System.Reactive/Disposables/RefCountDisposable.cs +++ b/Rx.NET/Source/src/System.Reactive/Disposables/RefCountDisposable.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.Threading; namespace System.Reactive.Disposables @@ -14,7 +12,9 @@ namespace System.Reactive.Disposables public sealed class RefCountDisposable : ICancelable { private readonly bool _throwWhenDisposed; - private IDisposable _disposable; + + private IDisposable? _disposable; + /// /// Holds the number of active child disposables and the /// indicator bit (31) if the main _disposable has been marked @@ -167,7 +167,7 @@ private void Release() private sealed class InnerDisposable : IDisposable { - private RefCountDisposable _parent; + private RefCountDisposable? _parent; public InnerDisposable(RefCountDisposable parent) { diff --git a/Rx.NET/Source/src/System.Reactive/Disposables/ScheduledDisposable.cs b/Rx.NET/Source/src/System.Reactive/Disposables/ScheduledDisposable.cs index 8196ea2a4e..f3819204f6 100644 --- a/Rx.NET/Source/src/System.Reactive/Disposables/ScheduledDisposable.cs +++ b/Rx.NET/Source/src/System.Reactive/Disposables/ScheduledDisposable.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; namespace System.Reactive.Disposables diff --git a/Rx.NET/Source/src/System.Reactive/Disposables/SerialDisposable.cs b/Rx.NET/Source/src/System.Reactive/Disposables/SerialDisposable.cs index 1d77b3f2bb..2c0c8a5fa9 100644 --- a/Rx.NET/Source/src/System.Reactive/Disposables/SerialDisposable.cs +++ b/Rx.NET/Source/src/System.Reactive/Disposables/SerialDisposable.cs @@ -2,9 +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.Disposables { /// @@ -12,7 +9,7 @@ namespace System.Reactive.Disposables /// public sealed class SerialDisposable : ICancelable { - private IDisposable _current; + private IDisposable? _current; /// /// Initializes a new instance of the class. @@ -30,7 +27,7 @@ public SerialDisposable() /// Gets or sets the underlying disposable. /// /// If the SerialDisposable has already been disposed, assignment to this property causes immediate disposal of the given disposable object. Assigning this property disposes the previous disposable object. - public IDisposable Disposable + public IDisposable? Disposable { get => Disposables.Disposable.GetValue(ref _current); set => Disposables.Disposable.TrySetSerial(ref _current, value); diff --git a/Rx.NET/Source/src/System.Reactive/Disposables/SingleAssignmentDisposable.cs b/Rx.NET/Source/src/System.Reactive/Disposables/SingleAssignmentDisposable.cs index ffcdec4e86..ffc4ee8681 100644 --- a/Rx.NET/Source/src/System.Reactive/Disposables/SingleAssignmentDisposable.cs +++ b/Rx.NET/Source/src/System.Reactive/Disposables/SingleAssignmentDisposable.cs @@ -2,9 +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.Disposables { /// @@ -13,7 +10,7 @@ namespace System.Reactive.Disposables /// public sealed class SingleAssignmentDisposable : ICancelable { - private IDisposable _current; + private IDisposable? _current; /// /// Initializes a new instance of the class. @@ -31,7 +28,7 @@ public SingleAssignmentDisposable() /// Gets or sets the underlying disposable. After disposal, the result of getting this property is undefined. /// /// Thrown if the has already been assigned to. - public IDisposable Disposable + public IDisposable? Disposable { get => Disposables.Disposable.GetValueOrDefault(ref _current); set => Disposables.Disposable.SetSingle(ref _current, value); diff --git a/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Core.verified.cs b/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Core.verified.cs index 487ee6495a..3880022b41 100644 --- a/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Core.verified.cs +++ b/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Core.verified.cs @@ -598,7 +598,7 @@ public interface ICancelable : System.IDisposable public sealed class MultipleAssignmentDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable { public MultipleAssignmentDisposable() { } - public System.IDisposable Disposable { get; set; } + public System.IDisposable? Disposable { get; set; } public bool IsDisposed { get; } public void Dispose() { } } @@ -621,14 +621,14 @@ public void Dispose() { } public sealed class SerialDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable { public SerialDisposable() { } - public System.IDisposable Disposable { get; set; } + public System.IDisposable? Disposable { get; set; } public bool IsDisposed { get; } public void Dispose() { } } public sealed class SingleAssignmentDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable { public SingleAssignmentDisposable() { } - public System.IDisposable Disposable { get; set; } + public System.IDisposable? Disposable { get; set; } public bool IsDisposed { get; } public void Dispose() { } }