From 145a0a987faf5534739d7f06816a9f65b6e8307b Mon Sep 17 00:00:00 2001
From: RLittlesII <6969701+RLittlesII@users.noreply.github.com>
Date: Tue, 17 Dec 2019 18:25:00 -0600
Subject: [PATCH 01/34] fix: C# 8 Nullibility Warnings
---
src/Directory.build.props | 2 ++
src/ReactiveUI.Winforms/RoutedViewHost.cs | 4 +--
src/ReactiveUI.Winforms/ViewModelViewHost.cs | 4 +--
.../DependencyObjectObservableForProperty.cs | 4 +--
.../TransitioningContentControl.cs | 18 +++++-----
...reatesCommandBindingViaCommandParameter.cs | 2 +-
.../Command/CreatesCommandBindingViaEvent.cs | 2 +-
.../Converter/EqualityTypeConverter.cs | 13 ++++---
.../Bindings/Converter/StringConverter.cs | 2 +-
.../Bindings/IBindingTypeConverter.cs | 2 +-
.../Property/PropertyBinderImplementation.cs | 8 ++---
src/ReactiveUI/Expression/Reflection.cs | 10 +++---
.../ReactiveNotifyPropertyChangedMixin.cs | 4 +--
.../OAPHCreationHelperMixin.cs | 34 +++++++++++++++----
.../android/AndroidObservableForWidgets.cs | 6 ++--
.../android/FlexibleCommandBinder.cs | 4 ++-
.../Platforms/android/ReactiveActivity.cs | 8 ++---
.../Platforms/apple-common/ReactiveView.cs | 2 +-
.../apple-common/TargetActionCommandBinder.cs | 3 +-
.../net4/ComponentModelTypeConverter.cs | 2 +-
.../DependencyObjectObservableForProperty.cs | 6 ++--
.../uap/SingleWindowDispatcherScheduler.cs | 12 +++----
.../ReactiveNavigationController.cs | 2 +-
.../ReactivePageViewController.cs | 2 +-
.../uikit-common/ReactiveTabBarController.cs | 2 +-
.../Platforms/uikit-common/RoutedViewHost.cs | 8 ++---
.../AutoDataTemplateBindingHook.cs | 4 +--
.../windows-common/PlatformOperations.cs | 2 +-
.../windows-common/RoutedViewHost.cs | 4 +--
.../windows-common/ViewModelViewHost.cs | 2 +-
.../IReactiveObjectExtensions.cs | 15 ++++++--
src/ReactiveUI/ReactiveUI.csproj | 1 +
src/ReactiveUI/Routing/MessageBus.cs | 2 +-
src/ReactiveUI/View/DefaultViewLocator.cs | 10 +++---
34 files changed, 123 insertions(+), 83 deletions(-)
diff --git a/src/Directory.build.props b/src/Directory.build.props
index c9cbc39db8..4807c96a65 100644
--- a/src/Directory.build.props
+++ b/src/Directory.build.props
@@ -29,6 +29,8 @@
true
$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
+ enable
+ latest
diff --git a/src/ReactiveUI.Winforms/RoutedViewHost.cs b/src/ReactiveUI.Winforms/RoutedViewHost.cs
index 7f068d1a2d..182d94e50a 100644
--- a/src/ReactiveUI.Winforms/RoutedViewHost.cs
+++ b/src/ReactiveUI.Winforms/RoutedViewHost.cs
@@ -20,7 +20,7 @@ public partial class RoutedControlHost : UserControl, IReactiveObject
private readonly CompositeDisposable _disposables = new CompositeDisposable();
private RoutingState _router;
private Control _defaultContent;
- private IObservable _viewContractObservable;
+ private IObservable? _viewContractObservable;
///
/// Initializes a new instance of the class.
@@ -116,7 +116,7 @@ public RoutingState Router
/// Gets or sets the view contract observable.
///
[Browsable(false)]
- public IObservable ViewContractObservable
+ public IObservable? ViewContractObservable
{
get => _viewContractObservable;
set => this.RaiseAndSetIfChanged(ref _viewContractObservable, value);
diff --git a/src/ReactiveUI.Winforms/ViewModelViewHost.cs b/src/ReactiveUI.Winforms/ViewModelViewHost.cs
index a91343daad..2b3fff6150 100644
--- a/src/ReactiveUI.Winforms/ViewModelViewHost.cs
+++ b/src/ReactiveUI.Winforms/ViewModelViewHost.cs
@@ -20,7 +20,7 @@ public partial class ViewModelControlHost : UserControl, IReactiveObject, IViewF
{
private readonly CompositeDisposable _disposables = new CompositeDisposable();
private Control _defaultContent;
- private IObservable _viewContractObservable;
+ private IObservable? _viewContractObservable;
private object _viewModel;
private object _content;
private bool _cacheViews;
@@ -73,7 +73,7 @@ public Control DefaultContent
/// The view contract observable.
///
[Browsable(false)]
- public IObservable ViewContractObservable
+ public IObservable? ViewContractObservable
{
get => _viewContractObservable;
set => this.RaiseAndSetIfChanged(ref _viewContractObservable, value);
diff --git a/src/ReactiveUI.Wpf/DependencyObjectObservableForProperty.cs b/src/ReactiveUI.Wpf/DependencyObjectObservableForProperty.cs
index b645baa989..a3b3e78f16 100644
--- a/src/ReactiveUI.Wpf/DependencyObjectObservableForProperty.cs
+++ b/src/ReactiveUI.Wpf/DependencyObjectObservableForProperty.cs
@@ -66,14 +66,14 @@ public IObservable> GetNotificationForProperty(o
});
}
- private static DependencyProperty GetDependencyProperty(Type type, string propertyName)
+ private static DependencyProperty? GetDependencyProperty(Type type, string propertyName)
{
var fi = type.GetTypeInfo().GetFields(BindingFlags.FlattenHierarchy | BindingFlags.Static | BindingFlags.Public)
.FirstOrDefault(x => x.Name == propertyName + "Property" && x.IsStatic);
if (fi != null)
{
- return (DependencyProperty)fi.GetValue(null);
+ return (DependencyProperty?)fi.GetValue(null);
}
return null;
diff --git a/src/ReactiveUI.Wpf/TransitioningContentControl.cs b/src/ReactiveUI.Wpf/TransitioningContentControl.cs
index e614935073..5692384d30 100644
--- a/src/ReactiveUI.Wpf/TransitioningContentControl.cs
+++ b/src/ReactiveUI.Wpf/TransitioningContentControl.cs
@@ -47,11 +47,11 @@ public class TransitioningContentControl : ContentControl
private const string NormalState = "Normal";
private bool _isTransitioning;
private bool _canSplitTransition;
- private Storyboard _startingTransition;
- private Storyboard _completingTransition;
- private Grid _container;
- private ContentPresenter _previousContentPresentationSite;
- private ContentPresenter _currentContentPresentationSite;
+ private Storyboard? _startingTransition;
+ private Storyboard? _completingTransition;
+ private Grid? _container;
+ private ContentPresenter? _previousContentPresentationSite;
+ private ContentPresenter? _currentContentPresentationSite;
///
/// Initializes a new instance of the class.
@@ -126,7 +126,7 @@ public enum TransitionPartType
/// The transition part.
public TransitionPartType TransitionPart { get => (TransitionPartType)GetValue(TransitionPartProperty); set => SetValue(TransitionPartProperty, value); }
- private Storyboard StartingTransition
+ private Storyboard? StartingTransition
{
get => _startingTransition;
set
@@ -139,7 +139,7 @@ private Storyboard StartingTransition
}
}
- private Storyboard CompletingTransition
+ private Storyboard? CompletingTransition
{
get => _completingTransition;
set
@@ -329,8 +329,8 @@ private Storyboard GetTransitionStoryboardByName(string transitionName)
///
private void SetTransitionDefaultValues()
{
- // Do some special handling of particular transitions so that we get nice smooth transitions that utilise the size of the content.
- if (Transition == TransitionType.FadeDown)
+ // Do some special handling of particular transitions so that we get nice smooth transitions that utilize the size of the content.
+ if (Transition == TransitionType.FadeDown && CompletingTransition != null)
{
var completingDoubleAnimation = (DoubleAnimation)CompletingTransition.Children[0];
completingDoubleAnimation.From = -ActualHeight;
diff --git a/src/ReactiveUI/Bindings/Command/CreatesCommandBindingViaCommandParameter.cs b/src/ReactiveUI/Bindings/Command/CreatesCommandBindingViaCommandParameter.cs
index 8986c71e9b..996fda4242 100644
--- a/src/ReactiveUI/Bindings/Command/CreatesCommandBindingViaCommandParameter.cs
+++ b/src/ReactiveUI/Bindings/Command/CreatesCommandBindingViaCommandParameter.cs
@@ -66,7 +66,7 @@ public IDisposable BindCommandToObject(ICommand command, object target, IObserva
}
///
- public IDisposable BindCommandToObject(ICommand command, object target, IObservable