diff --git a/.gitignore b/.gitignore
index 69c515f909..7965ec9224 100644
--- a/.gitignore
+++ b/.gitignore
@@ -365,4 +365,5 @@ src/Tools/
**/*.Android/**/[Rr]esource.[Dd]esigner.cs
**/*.Droid/**/[Rr]esource.[Dd]esigner.cs
**/Android/**/[Rr]esource.[Dd]esigner.cs
-**/Droid/**/[Rr]esource.[Dd]esigner.cs
\ No newline at end of file
+**/Droid/**/[Rr]esource.[Dd]esigner.cs
+**/[Rr]esources/[Rr]esource.[Dd]esigner.cs
\ No newline at end of file
diff --git a/src/Directory.build.props b/src/Directory.build.props
index 63a443a800..2f1a8435d6 100644
--- a/src/Directory.build.props
+++ b/src/Directory.build.props
@@ -29,6 +29,9 @@
true
$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
+ enable
+ latest
+ CS8600;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8623;CS8624;CS8625;CS8626;CS8627;CS8628;CS8629;CS8630;CS8634;CS8766;CS8767
diff --git a/src/ReactiveUI.AndroidSupport/ReactiveAppCompatActivity.cs b/src/ReactiveUI.AndroidSupport/ReactiveAppCompatActivity.cs
index 0dfdf0580a..431b8f6848 100644
--- a/src/ReactiveUI.AndroidSupport/ReactiveAppCompatActivity.cs
+++ b/src/ReactiveUI.AndroidSupport/ReactiveAppCompatActivity.cs
@@ -27,7 +27,7 @@ namespace ReactiveUI.AndroidSupport
public class ReactiveAppCompatActivity : ReactiveAppCompatActivity, IViewFor, ICanActivate
where TViewModel : class
{
- private TViewModel _viewModel;
+ private TViewModel? _viewModel;
///
/// Initializes a new instance of the class.
@@ -37,17 +37,17 @@ protected ReactiveAppCompatActivity()
}
///
- public TViewModel ViewModel
+ public TViewModel? ViewModel
{
get => _viewModel;
set => this.RaiseAndSetIfChanged(ref _viewModel, value);
}
///
- object IViewFor.ViewModel
+ object? IViewFor.ViewModel
{
get => _viewModel;
- set => _viewModel = (TViewModel)value;
+ set => _viewModel = (TViewModel?)value;
}
}
@@ -80,10 +80,10 @@ protected ReactiveAppCompatActivity(IntPtr handle, JniHandleOwnership ownership)
}
///
- public event PropertyChangingEventHandler PropertyChanging;
+ public event PropertyChangingEventHandler? PropertyChanging;
///
- public event PropertyChangedEventHandler PropertyChanged;
+ public event PropertyChangedEventHandler? PropertyChanged;
///
public IObservable> Changing => this.GetChangingObservable();
diff --git a/src/ReactiveUI.AndroidSupport/ReactiveDialogFragment.cs b/src/ReactiveUI.AndroidSupport/ReactiveDialogFragment.cs
index 800b5c08a0..426cefe9c1 100644
--- a/src/ReactiveUI.AndroidSupport/ReactiveDialogFragment.cs
+++ b/src/ReactiveUI.AndroidSupport/ReactiveDialogFragment.cs
@@ -21,7 +21,7 @@ namespace ReactiveUI.AndroidSupport
public class ReactiveDialogFragment : ReactiveDialogFragment, IViewFor, ICanActivate
where TViewModel : class
{
- private TViewModel _viewModel;
+ private TViewModel? _viewModel;
///
/// Initializes a new instance of the class.
@@ -31,17 +31,17 @@ protected ReactiveDialogFragment()
}
///
- public TViewModel ViewModel
+ public TViewModel? ViewModel
{
get => _viewModel;
set => this.RaiseAndSetIfChanged(ref _viewModel, value);
}
///
- object IViewFor.ViewModel
+ object? IViewFor.ViewModel
{
get => _viewModel;
- set => _viewModel = (TViewModel)value;
+ set => _viewModel = (TViewModel?)value;
}
}
@@ -63,10 +63,10 @@ protected ReactiveDialogFragment()
}
///
- public event PropertyChangingEventHandler PropertyChanging;
+ public event PropertyChangingEventHandler? PropertyChanging;
///
- public event PropertyChangedEventHandler PropertyChanged;
+ public event PropertyChangedEventHandler? PropertyChanged;
///
public IObservable ThrownExceptions => this.GetThrownExceptionsObservable();
diff --git a/src/ReactiveUI.AndroidSupport/ReactiveFragment.cs b/src/ReactiveUI.AndroidSupport/ReactiveFragment.cs
index f06525cd0b..c5c0a392ca 100644
--- a/src/ReactiveUI.AndroidSupport/ReactiveFragment.cs
+++ b/src/ReactiveUI.AndroidSupport/ReactiveFragment.cs
@@ -21,7 +21,7 @@ namespace ReactiveUI.AndroidSupport
public class ReactiveFragment : ReactiveFragment, IViewFor, ICanActivate
where TViewModel : class
{
- private TViewModel _viewModel;
+ private TViewModel? _viewModel;
///
/// Initializes a new instance of the class.
@@ -31,17 +31,17 @@ protected ReactiveFragment()
}
///
- public TViewModel ViewModel
+ public TViewModel? ViewModel
{
get => _viewModel;
set => this.RaiseAndSetIfChanged(ref _viewModel, value);
}
///
- object IViewFor.ViewModel
+ object? IViewFor.ViewModel
{
get => _viewModel;
- set => _viewModel = (TViewModel)value;
+ set => _viewModel = (TViewModel?)value;
}
}
@@ -63,10 +63,10 @@ protected ReactiveFragment()
}
///
- public event PropertyChangingEventHandler PropertyChanging;
+ public event PropertyChangingEventHandler? PropertyChanging;
///
- public event PropertyChangedEventHandler PropertyChanged;
+ public event PropertyChangedEventHandler? PropertyChanged;
///
public IObservable ThrownExceptions => this.GetThrownExceptionsObservable();
diff --git a/src/ReactiveUI.AndroidSupport/ReactiveFragmentActivity.cs b/src/ReactiveUI.AndroidSupport/ReactiveFragmentActivity.cs
index 0bfdf52464..c8d3f8af1b 100644
--- a/src/ReactiveUI.AndroidSupport/ReactiveFragmentActivity.cs
+++ b/src/ReactiveUI.AndroidSupport/ReactiveFragmentActivity.cs
@@ -27,7 +27,7 @@ namespace ReactiveUI.AndroidSupport
public class ReactiveFragmentActivity : ReactiveFragmentActivity, IViewFor, ICanActivate
where TViewModel : class
{
- private TViewModel _viewModel;
+ private TViewModel? _viewModel;
///
/// Initializes a new instance of the class.
@@ -37,17 +37,17 @@ protected ReactiveFragmentActivity()
}
///
- public TViewModel ViewModel
+ public TViewModel? ViewModel
{
get => _viewModel;
set => this.RaiseAndSetIfChanged(ref _viewModel, value);
}
///
- object IViewFor.ViewModel
+ object? IViewFor.ViewModel
{
get => _viewModel;
- set => _viewModel = (TViewModel)value;
+ set => _viewModel = (TViewModel?)value;
}
}
@@ -63,10 +63,10 @@ public class ReactiveFragmentActivity : FragmentActivity, IReactiveObject, IReac
private readonly Subject<(int requestCode, Result result, Intent intent)> _activityResult = new Subject<(int requestCode, Result result, Intent intent)>();
///
- public event PropertyChangingEventHandler PropertyChanging;
+ public event PropertyChangingEventHandler? PropertyChanging;
///
- public event PropertyChangedEventHandler PropertyChanged;
+ public event PropertyChangedEventHandler? PropertyChanged;
///
public IObservable> Changing => this.GetChangingObservable();
@@ -78,7 +78,7 @@ public class ReactiveFragmentActivity : FragmentActivity, IReactiveObject, IReac
public IObservable ThrownExceptions => this.GetThrownExceptionsObservable();
///
- /// Gets a singal when the activity fragment is activated.
+ /// Gets a signal when the activity fragment is activated.
///
public IObservable Activated => _activated.AsObservable();
diff --git a/src/ReactiveUI.AndroidSupport/ReactivePagerAdapter.cs b/src/ReactiveUI.AndroidSupport/ReactivePagerAdapter.cs
index f0a1326491..b2178f0c6d 100644
--- a/src/ReactiveUI.AndroidSupport/ReactivePagerAdapter.cs
+++ b/src/ReactiveUI.AndroidSupport/ReactivePagerAdapter.cs
@@ -28,7 +28,7 @@ public class ReactivePagerAdapter : PagerAdapter, IEnableLogger
{
private readonly SourceList _list;
private readonly Func _viewCreator;
- private readonly Action _viewInitializer;
+ private readonly Action? _viewInitializer;
private readonly IDisposable _inner;
///
@@ -40,7 +40,7 @@ public class ReactivePagerAdapter : PagerAdapter, IEnableLogger
public ReactivePagerAdapter(
IObservable> changeSet,
Func viewCreator,
- Action viewInitializer = null)
+ Action? viewInitializer = null)
{
_list = new SourceList(changeSet);
_viewCreator = viewCreator;
@@ -132,7 +132,7 @@ public class ReactivePagerAdapter : ReactivePagerAdapte
public ReactivePagerAdapter(
TCollection collection,
Func viewCreator,
- Action viewInitializer = null)
+ Action? viewInitializer = null)
: base(collection.ToObservableChangeSet(), viewCreator, viewInitializer)
{
}
diff --git a/src/ReactiveUI.AndroidSupport/ReactivePreferenceFragment.cs b/src/ReactiveUI.AndroidSupport/ReactivePreferenceFragment.cs
index 987c5d2f24..b8c7b18b8d 100644
--- a/src/ReactiveUI.AndroidSupport/ReactivePreferenceFragment.cs
+++ b/src/ReactiveUI.AndroidSupport/ReactivePreferenceFragment.cs
@@ -23,7 +23,7 @@ namespace ReactiveUI.AndroidSupport
public abstract class ReactivePreferenceFragment : ReactivePreferenceFragment, IViewFor, ICanActivate
where TViewModel : class
{
- private TViewModel _viewModel;
+ private TViewModel? _viewModel;
///
/// Initializes a new instance of the class.
@@ -43,17 +43,17 @@ protected ReactivePreferenceFragment(IntPtr handle, JniHandleOwnership ownership
}
///
- public TViewModel ViewModel
+ public TViewModel? ViewModel
{
get => _viewModel;
set => this.RaiseAndSetIfChanged(ref _viewModel, value);
}
///
- object IViewFor.ViewModel
+ object? IViewFor.ViewModel
{
get => _viewModel;
- set => _viewModel = (TViewModel)value;
+ set => _viewModel = (TViewModel?)value;
}
}
@@ -85,10 +85,10 @@ protected ReactivePreferenceFragment(IntPtr handle, JniHandleOwnership ownership
}
///
- public event PropertyChangingEventHandler PropertyChanging;
+ public event PropertyChangingEventHandler? PropertyChanging;
///
- public event PropertyChangedEventHandler PropertyChanged;
+ public event PropertyChangedEventHandler? PropertyChanged;
///
public IObservable> Changing => this.GetChangingObservable();
diff --git a/src/ReactiveUI.AndroidSupport/ReactiveRecyclerViewAdapter.cs b/src/ReactiveUI.AndroidSupport/ReactiveRecyclerViewAdapter.cs
index e8c4e20bef..29e84d2cc2 100644
--- a/src/ReactiveUI.AndroidSupport/ReactiveRecyclerViewAdapter.cs
+++ b/src/ReactiveUI.AndroidSupport/ReactiveRecyclerViewAdapter.cs
@@ -60,7 +60,7 @@ public override int GetItemViewType(int position)
/// The position of the current view in the list.
/// The ViewModel associated with the current View.
/// An ID to be used in OnCreateViewHolder.
- public virtual int GetItemViewType(int position, TViewModel viewModel)
+ public virtual int GetItemViewType(int position, TViewModel? viewModel)
{
return base.GetItemViewType(position);
}
@@ -93,7 +93,7 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
}
- private TViewModel GetViewModelByPosition(int position)
+ private TViewModel? GetViewModelByPosition(int position)
{
return position >= _list.Count ? null : _list.Items.ElementAt(position);
}
diff --git a/src/ReactiveUI.AndroidSupport/ReactiveRecyclerViewViewHolder.cs b/src/ReactiveUI.AndroidSupport/ReactiveRecyclerViewViewHolder.cs
index b984e447bb..cd03d10690 100644
--- a/src/ReactiveUI.AndroidSupport/ReactiveRecyclerViewViewHolder.cs
+++ b/src/ReactiveUI.AndroidSupport/ReactiveRecyclerViewViewHolder.cs
@@ -29,9 +29,9 @@ public class ReactiveRecyclerViewViewHolder : RecyclerView.ViewHolde
[SuppressMessage("Design", "CA1051: Do not declare visible instance fields", Justification = "Legacy reasons")]
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1306: Field should start with a lower case letter", Justification = "Legacy reasons")]
[IgnoreDataMember]
- protected Lazy AllPublicProperties;
+ protected Lazy AllPublicProperties = null!;
- private TViewModel _viewModel;
+ private TViewModel? _viewModel;
///
/// Initializes a new instance of the class.
@@ -60,7 +60,7 @@ protected ReactiveRecyclerViewViewHolder(View view)
h => view.LongClick += h,
h => view.LongClick -= h);
- SelectedWithViewModel = Observable.FromEvent(
+ SelectedWithViewModel = Observable.FromEvent(
eventHandler =>
{
void Handler(object sender, EventArgs e) => eventHandler(ViewModel);
@@ -69,7 +69,7 @@ protected ReactiveRecyclerViewViewHolder(View view)
h => view.Click += h,
h => view.Click -= h);
- LongClickedWithViewModel = Observable.FromEvent, TViewModel>(
+ LongClickedWithViewModel = Observable.FromEvent, TViewModel?>(
eventHandler =>
{
void Handler(object sender, View.LongClickEventArgs e) => eventHandler(ViewModel);
@@ -80,10 +80,10 @@ protected ReactiveRecyclerViewViewHolder(View view)
}
///
- public event PropertyChangingEventHandler PropertyChanging;
+ public event PropertyChangingEventHandler PropertyChanging = null!;
///
- public event PropertyChangedEventHandler PropertyChanged;
+ public event PropertyChangedEventHandler PropertyChanged = null!;
///
/// Gets an observable that signals that this ViewHolder has been selected.
@@ -98,7 +98,7 @@ protected ReactiveRecyclerViewViewHolder(View view)
///
/// The is the ViewModel of this ViewHolder in the .
///
- public IObservable SelectedWithViewModel { get; }
+ public IObservable SelectedWithViewModel { get; }
///
/// Gets an observable that signals that this ViewHolder has been long-clicked.
@@ -113,7 +113,7 @@ protected ReactiveRecyclerViewViewHolder(View view)
///
/// The is the ViewModel of this ViewHolder in the .
///
- public IObservable LongClickedWithViewModel { get; }
+ public IObservable LongClickedWithViewModel { get; }
///
/// Gets the current view being shown.
@@ -121,7 +121,7 @@ protected ReactiveRecyclerViewViewHolder(View view)
public View View => ItemView;
///
- public TViewModel ViewModel
+ public TViewModel? ViewModel
{
get => _viewModel;
set => this.RaiseAndSetIfChanged(ref _viewModel, value);
@@ -134,10 +134,10 @@ public TViewModel ViewModel
public IObservable ThrownExceptions => this.GetThrownExceptionsObservable();
///
- object IViewFor.ViewModel
+ object? IViewFor.ViewModel
{
get => ViewModel;
- set => ViewModel = (TViewModel)value;
+ set => ViewModel = (TViewModel?)value;
}
///
diff --git a/src/ReactiveUI.AndroidSupport/ReactiveUI.AndroidSupport.csproj b/src/ReactiveUI.AndroidSupport/ReactiveUI.AndroidSupport.csproj
index 4a7f6ab8ae..2218e7bdcb 100644
--- a/src/ReactiveUI.AndroidSupport/ReactiveUI.AndroidSupport.csproj
+++ b/src/ReactiveUI.AndroidSupport/ReactiveUI.AndroidSupport.csproj
@@ -4,6 +4,7 @@
MonoAndroid90
Provides ReactiveUI extensions for the Android Support Library
ReactiveUI.AndroidSupport
+ enable
latest
mvvm;reactiveui;rx;reactive extensions;observable;LINQ;events;frp;xamarin;android;forms;monodroid;monotouch;xamarin.android;net;
diff --git a/src/ReactiveUI.AndroidX/ReactiveAppCompatActivity.cs b/src/ReactiveUI.AndroidX/ReactiveAppCompatActivity.cs
index 7097e67686..c199aa22ff 100644
--- a/src/ReactiveUI.AndroidX/ReactiveAppCompatActivity.cs
+++ b/src/ReactiveUI.AndroidX/ReactiveAppCompatActivity.cs
@@ -27,7 +27,7 @@ namespace ReactiveUI.AndroidX
public class ReactiveAppCompatActivity : ReactiveAppCompatActivity, IViewFor, ICanActivate
where TViewModel : class
{
- private TViewModel _viewModel;
+ private TViewModel? _viewModel;
///
/// Initializes a new instance of the class.
@@ -37,17 +37,17 @@ protected ReactiveAppCompatActivity()
}
///
- public TViewModel ViewModel
+ public TViewModel? ViewModel
{
get => _viewModel;
set => this.RaiseAndSetIfChanged(ref _viewModel, value);
}
///
- object IViewFor.ViewModel
+ object? IViewFor.ViewModel
{
get => _viewModel;
- set => _viewModel = (TViewModel)value;
+ set => _viewModel = (TViewModel?)value;
}
}
@@ -80,10 +80,10 @@ protected ReactiveAppCompatActivity(IntPtr handle, JniHandleOwnership ownership)
}
///
- public event PropertyChangingEventHandler PropertyChanging;
+ public event PropertyChangingEventHandler? PropertyChanging;
///
- public event PropertyChangedEventHandler PropertyChanged;
+ public event PropertyChangedEventHandler? PropertyChanged;
///
public IObservable> Changing => this.GetChangingObservable();
diff --git a/src/ReactiveUI.AndroidX/ReactiveDialogFragment.cs b/src/ReactiveUI.AndroidX/ReactiveDialogFragment.cs
index cedf0dd587..88d9b7ec8e 100644
--- a/src/ReactiveUI.AndroidX/ReactiveDialogFragment.cs
+++ b/src/ReactiveUI.AndroidX/ReactiveDialogFragment.cs
@@ -21,7 +21,7 @@ namespace ReactiveUI.AndroidX
public class ReactiveDialogFragment : ReactiveDialogFragment, IViewFor, ICanActivate
where TViewModel : class
{
- private TViewModel _viewModel;
+ private TViewModel? _viewModel;
///
/// Initializes a new instance of the class.
@@ -31,17 +31,17 @@ protected ReactiveDialogFragment()
}
///
- public TViewModel ViewModel
+ public TViewModel? ViewModel
{
get => _viewModel;
set => this.RaiseAndSetIfChanged(ref _viewModel, value);
}
///
- object IViewFor.ViewModel
+ object? IViewFor.ViewModel
{
get => _viewModel;
- set => _viewModel = (TViewModel)value;
+ set => _viewModel = (TViewModel?)value;
}
}
@@ -63,10 +63,10 @@ protected ReactiveDialogFragment()
}
///
- public event PropertyChangingEventHandler PropertyChanging;
+ public event PropertyChangingEventHandler? PropertyChanging;
///
- public event PropertyChangedEventHandler PropertyChanged;
+ public event PropertyChangedEventHandler? PropertyChanged;
///
public IObservable ThrownExceptions => this.GetThrownExceptionsObservable();
diff --git a/src/ReactiveUI.AndroidX/ReactiveFragment.cs b/src/ReactiveUI.AndroidX/ReactiveFragment.cs
index 10dceded19..739de2b6b3 100644
--- a/src/ReactiveUI.AndroidX/ReactiveFragment.cs
+++ b/src/ReactiveUI.AndroidX/ReactiveFragment.cs
@@ -21,7 +21,7 @@ namespace ReactiveUI.AndroidX
public class ReactiveFragment : ReactiveFragment, IViewFor, ICanActivate
where TViewModel : class
{
- private TViewModel _viewModel;
+ private TViewModel? _viewModel;
///
/// Initializes a new instance of the class.
@@ -31,17 +31,17 @@ protected ReactiveFragment()
}
///
- public TViewModel ViewModel
+ public TViewModel? ViewModel
{
get => _viewModel;
set => this.RaiseAndSetIfChanged(ref _viewModel, value);
}
///
- object IViewFor.ViewModel
+ object? IViewFor.ViewModel
{
get => _viewModel;
- set => _viewModel = (TViewModel)value;
+ set => _viewModel = (TViewModel?)value;
}
}
@@ -63,10 +63,10 @@ protected ReactiveFragment()
}
///
- public event PropertyChangingEventHandler PropertyChanging;
+ public event PropertyChangingEventHandler? PropertyChanging;
///
- public event PropertyChangedEventHandler PropertyChanged;
+ public event PropertyChangedEventHandler? PropertyChanged;
///
public IObservable ThrownExceptions => this.GetThrownExceptionsObservable();
diff --git a/src/ReactiveUI.AndroidX/ReactiveFragmentActivity.cs b/src/ReactiveUI.AndroidX/ReactiveFragmentActivity.cs
index 5b0adb2e0a..cbd1bab194 100644
--- a/src/ReactiveUI.AndroidX/ReactiveFragmentActivity.cs
+++ b/src/ReactiveUI.AndroidX/ReactiveFragmentActivity.cs
@@ -26,7 +26,7 @@ namespace ReactiveUI.AndroidX
public class ReactiveFragmentActivity : ReactiveFragmentActivity, IViewFor, ICanActivate
where TViewModel : class
{
- private TViewModel _viewModel;
+ private TViewModel? _viewModel;
///
/// Initializes a new instance of the class.
@@ -36,17 +36,17 @@ protected ReactiveFragmentActivity()
}
///
- public TViewModel ViewModel
+ public TViewModel? ViewModel
{
get => _viewModel;
set => this.RaiseAndSetIfChanged(ref _viewModel, value);
}
///
- object IViewFor.ViewModel
+ object? IViewFor.ViewModel
{
get => _viewModel;
- set => _viewModel = (TViewModel)value;
+ set => _viewModel = (TViewModel?)value;
}
}
@@ -62,10 +62,10 @@ public class ReactiveFragmentActivity : FragmentActivity, IReactiveObject, IReac
private readonly Subject<(int requestCode, Result result, Intent intent)> _activityResult = new Subject<(int requestCode, Result result, Intent intent)>();
///
- public event PropertyChangingEventHandler PropertyChanging;
+ public event PropertyChangingEventHandler? PropertyChanging;
///
- public event PropertyChangedEventHandler PropertyChanged;
+ public event PropertyChangedEventHandler? PropertyChanged;
///
public IObservable> Changing => this.GetChangingObservable();
diff --git a/src/ReactiveUI.AndroidX/ReactivePagerAdapter.cs b/src/ReactiveUI.AndroidX/ReactivePagerAdapter.cs
index 9b554daf9e..e6186c1cf1 100644
--- a/src/ReactiveUI.AndroidX/ReactivePagerAdapter.cs
+++ b/src/ReactiveUI.AndroidX/ReactivePagerAdapter.cs
@@ -28,7 +28,7 @@ public class ReactivePagerAdapter : PagerAdapter, IEnableLogger
{
private readonly SourceList _list;
private readonly Func _viewCreator;
- private readonly Action _viewInitializer;
+ private readonly Action? _viewInitializer;
private readonly IDisposable _inner;
///
@@ -40,7 +40,7 @@ public class ReactivePagerAdapter : PagerAdapter, IEnableLogger
public ReactivePagerAdapter(
IObservable> changeSet,
Func viewCreator,
- Action viewInitializer = null)
+ Action? viewInitializer = null)
{
_list = new SourceList(changeSet);
_viewCreator = viewCreator;
@@ -132,7 +132,7 @@ public class ReactivePagerAdapter : ReactivePagerAdapte
public ReactivePagerAdapter(
TCollection collection,
Func viewCreator,
- Action viewInitializer = null)
+ Action? viewInitializer = null)
: base(collection.ToObservableChangeSet(), viewCreator, viewInitializer)
{
}
diff --git a/src/ReactiveUI.AndroidX/ReactivePreferenceFragment.cs b/src/ReactiveUI.AndroidX/ReactivePreferenceFragment.cs
index 051fcd7b2d..db09c77c44 100644
--- a/src/ReactiveUI.AndroidX/ReactivePreferenceFragment.cs
+++ b/src/ReactiveUI.AndroidX/ReactivePreferenceFragment.cs
@@ -23,7 +23,7 @@ namespace ReactiveUI.AndroidX
public abstract class ReactivePreferenceFragment : ReactivePreferenceFragment, IViewFor, ICanActivate
where TViewModel : class
{
- private TViewModel _viewModel;
+ private TViewModel? _viewModel;
///
/// Initializes a new instance of the class.
@@ -43,17 +43,17 @@ protected ReactivePreferenceFragment(IntPtr handle, JniHandleOwnership ownership
}
///
- public TViewModel ViewModel
+ public TViewModel? ViewModel
{
get => _viewModel;
set => this.RaiseAndSetIfChanged(ref _viewModel, value);
}
///
- object IViewFor.ViewModel
+ object? IViewFor.ViewModel
{
get => _viewModel;
- set => _viewModel = (TViewModel)value;
+ set => _viewModel = (TViewModel?)value;
}
}
@@ -85,10 +85,10 @@ protected ReactivePreferenceFragment(IntPtr handle, JniHandleOwnership ownership
}
///
- public event PropertyChangingEventHandler PropertyChanging;
+ public event PropertyChangingEventHandler? PropertyChanging;
///
- public event PropertyChangedEventHandler PropertyChanged;
+ public event PropertyChangedEventHandler? PropertyChanged;
///
public IObservable> Changing => this.GetChangingObservable();
diff --git a/src/ReactiveUI.AndroidX/ReactiveRecyclerViewAdapter.cs b/src/ReactiveUI.AndroidX/ReactiveRecyclerViewAdapter.cs
index da7064785f..52e01e60f9 100644
--- a/src/ReactiveUI.AndroidX/ReactiveRecyclerViewAdapter.cs
+++ b/src/ReactiveUI.AndroidX/ReactiveRecyclerViewAdapter.cs
@@ -56,7 +56,7 @@ public override int GetItemViewType(int position)
/// The position of the current view in the list.
/// The ViewModel associated with the current View.
/// An ID to be used in OnCreateViewHolder.
- public virtual int GetItemViewType(int position, TViewModel viewModel)
+ public virtual int GetItemViewType(int position, TViewModel? viewModel)
{
return base.GetItemViewType(position);
}
@@ -89,7 +89,7 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
}
- private TViewModel GetViewModelByPosition(int position)
+ private TViewModel? GetViewModelByPosition(int position)
{
return position >= _list.Count ? null : _list.Items.ElementAt(position);
}
diff --git a/src/ReactiveUI.AndroidX/ReactiveRecyclerViewViewHolder.cs b/src/ReactiveUI.AndroidX/ReactiveRecyclerViewViewHolder.cs
index 5841a86718..1d2f604aa8 100644
--- a/src/ReactiveUI.AndroidX/ReactiveRecyclerViewViewHolder.cs
+++ b/src/ReactiveUI.AndroidX/ReactiveRecyclerViewViewHolder.cs
@@ -29,9 +29,9 @@ public class ReactiveRecyclerViewViewHolder : RecyclerView.ViewHolde
[SuppressMessage("Design", "CA1051: Do not declare visible instance fields", Justification = "Legacy reasons")]
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1306: Field should start with a lower case letter", Justification = "Legacy reasons")]
[IgnoreDataMember]
- protected Lazy AllPublicProperties;
+ protected Lazy? AllPublicProperties;
- private TViewModel _viewModel;
+ private TViewModel? _viewModel;
///
/// Initializes a new instance of the class.
@@ -60,7 +60,7 @@ protected ReactiveRecyclerViewViewHolder(View view)
h => view.LongClick += h,
h => view.LongClick -= h);
- SelectedWithViewModel = Observable.FromEvent(
+ SelectedWithViewModel = Observable.FromEvent(
eventHandler =>
{
void Handler(object sender, EventArgs e) => eventHandler(ViewModel);
@@ -69,7 +69,7 @@ protected ReactiveRecyclerViewViewHolder(View view)
h => view.Click += h,
h => view.Click -= h);
- LongClickedWithViewModel = Observable.FromEvent, TViewModel>(
+ LongClickedWithViewModel = Observable.FromEvent, TViewModel?>(
eventHandler =>
{
void Handler(object sender, View.LongClickEventArgs e) => eventHandler(ViewModel);
@@ -80,10 +80,10 @@ protected ReactiveRecyclerViewViewHolder(View view)
}
///
- public event PropertyChangingEventHandler PropertyChanging;
+ public event PropertyChangingEventHandler? PropertyChanging;
///
- public event PropertyChangedEventHandler PropertyChanged;
+ public event PropertyChangedEventHandler? PropertyChanged;
///
/// Gets an observable that signals that this ViewHolder has been selected.
@@ -98,7 +98,7 @@ protected ReactiveRecyclerViewViewHolder(View view)
///
/// The is the ViewModel of this ViewHolder in the .
///
- public IObservable SelectedWithViewModel { get; }
+ public IObservable SelectedWithViewModel { get; }
///
/// Gets an observable that signals that this ViewHolder has been long-clicked.
@@ -113,7 +113,7 @@ protected ReactiveRecyclerViewViewHolder(View view)
///
/// The is the ViewModel of this ViewHolder in the .
///
- public IObservable LongClickedWithViewModel { get; }
+ public IObservable LongClickedWithViewModel { get; }
///
/// Gets the current view being shown.
@@ -121,7 +121,7 @@ protected ReactiveRecyclerViewViewHolder(View view)
public View View => ItemView;
///
- public TViewModel ViewModel
+ public TViewModel? ViewModel
{
get => _viewModel;
set => this.RaiseAndSetIfChanged(ref _viewModel, value);
@@ -134,10 +134,10 @@ public TViewModel ViewModel
public IObservable ThrownExceptions => this.GetThrownExceptionsObservable();
///
- object IViewFor.ViewModel
+ object? IViewFor.ViewModel
{
get => ViewModel;
- set => ViewModel = (TViewModel)value;
+ set => ViewModel = (TViewModel?)value;
}
///
diff --git a/src/ReactiveUI.AndroidX/ReactiveUI.AndroidX.csproj b/src/ReactiveUI.AndroidX/ReactiveUI.AndroidX.csproj
index 5dcbb10ff3..b14dc9d7a3 100644
--- a/src/ReactiveUI.AndroidX/ReactiveUI.AndroidX.csproj
+++ b/src/ReactiveUI.AndroidX/ReactiveUI.AndroidX.csproj
@@ -4,6 +4,7 @@
MonoAndroid90
Provides ReactiveUI extensions for the AndroidX Library
ReactiveUI.AndroidX
+ enable
latest
mvvm;reactiveui;rx;reactive extensions;observable;LINQ;events;frp;xamarin;android;forms;monodroid;monotouch;xamarin.android;net;
diff --git a/src/ReactiveUI.Blazor/PlatformOperations.cs b/src/ReactiveUI.Blazor/PlatformOperations.cs
index 5895193b47..e8c782c74b 100644
--- a/src/ReactiveUI.Blazor/PlatformOperations.cs
+++ b/src/ReactiveUI.Blazor/PlatformOperations.cs
@@ -11,7 +11,7 @@ namespace ReactiveUI.Blazor
public class PlatformOperations : IPlatformOperations
{
///
- public string GetOrientation()
+ public string? GetOrientation()
{
return null;
}
diff --git a/src/ReactiveUI.Blazor/ReactiveComponentBase.cs b/src/ReactiveUI.Blazor/ReactiveComponentBase.cs
index 85d8edefa9..8b0415f7c3 100644
--- a/src/ReactiveUI.Blazor/ReactiveComponentBase.cs
+++ b/src/ReactiveUI.Blazor/ReactiveComponentBase.cs
@@ -29,21 +29,21 @@ public class ReactiveComponentBase : ComponentBase, IViewFor, INotifyPrope
private readonly Subject _deactivateSubject = new Subject();
private readonly CompositeDisposable _compositeDisposable = new CompositeDisposable();
- private T _viewModel;
+ private T? _viewModel;
private bool _disposedValue; // To detect redundant calls
///
- public event PropertyChangedEventHandler PropertyChanged;
+ public event PropertyChangedEventHandler? PropertyChanged;
///
[Parameter]
- public T ViewModel
+ public T? ViewModel
{
get => _viewModel;
set
{
- if (EqualityComparer.Default.Equals(_viewModel, value))
+ if (EqualityComparer.Default.Equals(_viewModel, value))
{
return;
}
@@ -54,10 +54,10 @@ public T ViewModel
}
///
- object IViewFor.ViewModel
+ object? IViewFor.ViewModel
{
get => ViewModel;
- set => ViewModel = (T)value;
+ set => ViewModel = (T?)value;
}
///
@@ -106,8 +106,8 @@ protected override void OnAfterRender(bool firstRender)
void Handler(object sender, PropertyChangedEventArgs e) => eventHandler(Unit.Default);
return Handler;
},
- eh => x.PropertyChanged += eh,
- eh => x.PropertyChanged -= eh))
+ eh => x!.PropertyChanged += eh,
+ eh => x!.PropertyChanged -= eh))
.Switch()
.Subscribe(_ => InvokeAsync(StateHasChanged))
.DisposeWith(_compositeDisposable);
@@ -120,7 +120,7 @@ protected override void OnAfterRender(bool firstRender)
/// Invokes the property changed event.
///
/// The name of the property.
- protected virtual void OnPropertyChanged([CallerMemberName]string propertyName = null)
+ protected virtual void OnPropertyChanged([CallerMemberName]string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
diff --git a/src/ReactiveUI.Blazor/ReactiveInjectableComponentBase.cs b/src/ReactiveUI.Blazor/ReactiveInjectableComponentBase.cs
index a1d1eb96a3..cab42eeb88 100644
--- a/src/ReactiveUI.Blazor/ReactiveInjectableComponentBase.cs
+++ b/src/ReactiveUI.Blazor/ReactiveInjectableComponentBase.cs
@@ -29,21 +29,21 @@ public class ReactiveInjectableComponentBase : ComponentBase, IViewFor, IN
private readonly Subject _deactivateSubject = new Subject();
private readonly CompositeDisposable _compositeDisposable = new CompositeDisposable();
- private T _viewModel;
+ private T? _viewModel;
private bool _disposedValue; // To detect redundant calls
///
- public event PropertyChangedEventHandler PropertyChanged;
+ public event PropertyChangedEventHandler? PropertyChanged;
///
[Inject]
- public T ViewModel
+ public T? ViewModel
{
get => _viewModel;
set
{
- if (EqualityComparer.Default.Equals(_viewModel, value))
+ if (EqualityComparer.Default.Equals(_viewModel, value))
{
return;
}
@@ -54,10 +54,10 @@ public T ViewModel
}
///
- object IViewFor.ViewModel
+ object? IViewFor.ViewModel
{
get => ViewModel;
- set => ViewModel = (T)value;
+ set => ViewModel = (T?)value;
}
///
@@ -106,8 +106,8 @@ protected override void OnAfterRender(bool firstRender)
void Handler(object sender, PropertyChangedEventArgs e) => eventHandler(Unit.Default);
return Handler;
},
- eh => x.PropertyChanged += eh,
- eh => x.PropertyChanged -= eh))
+ eh => x!.PropertyChanged += eh,
+ eh => x!.PropertyChanged -= eh))
.Switch()
.Subscribe(_ => InvokeAsync(StateHasChanged))
.DisposeWith(_compositeDisposable);
@@ -120,7 +120,7 @@ protected override void OnAfterRender(bool firstRender)
/// Invokes the property changed event.
///
/// The name of the property.
- protected virtual void OnPropertyChanged([CallerMemberName]string propertyName = null)
+ protected virtual void OnPropertyChanged([CallerMemberName]string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
diff --git a/src/ReactiveUI.Blazor/ReactiveLayoutComponentBase.cs b/src/ReactiveUI.Blazor/ReactiveLayoutComponentBase.cs
index e62ea9b400..8ee6cdca73 100644
--- a/src/ReactiveUI.Blazor/ReactiveLayoutComponentBase.cs
+++ b/src/ReactiveUI.Blazor/ReactiveLayoutComponentBase.cs
@@ -25,20 +25,20 @@ public class ReactiveLayoutComponentBase : LayoutComponentBase, IViewFor,
{
private readonly Subject _initSubject = new Subject();
- private T _viewModel;
+ private T? _viewModel;
private bool _disposedValue; // To detect redundant calls
///
- public event PropertyChangedEventHandler PropertyChanged;
+ public event PropertyChangedEventHandler? PropertyChanged;
///
- public T ViewModel
+ public T? ViewModel
{
get => _viewModel;
set
{
- if (EqualityComparer.Default.Equals(_viewModel, value))
+ if (EqualityComparer.Default.Equals(_viewModel, value))
{
return;
}
@@ -49,10 +49,10 @@ public T ViewModel
}
///
- object IViewFor.ViewModel
+ object? IViewFor.ViewModel
{
get => ViewModel;
- set => ViewModel = (T)value;
+ set => ViewModel = (T?)value;
}
///
@@ -95,8 +95,8 @@ protected override void OnAfterRender(bool isFirstRender)
void Handler(object sender, PropertyChangedEventArgs e) => eventHandler(Unit.Default);
return Handler;
},
- eh => x.PropertyChanged += eh,
- eh => x.PropertyChanged -= eh))
+ eh => x!.PropertyChanged += eh,
+ eh => x!.PropertyChanged -= eh))
.Switch()
.Do(_ => InvokeAsync(StateHasChanged))
.Subscribe();
@@ -106,7 +106,7 @@ protected override void OnAfterRender(bool isFirstRender)
/// Invokes the property changed event.
///
/// The name of the property.
- protected virtual void OnPropertyChanged([CallerMemberName]string propertyName = null)
+ protected virtual void OnPropertyChanged([CallerMemberName]string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
diff --git a/src/ReactiveUI.Blazor/ReactiveUI.Blazor.csproj b/src/ReactiveUI.Blazor/ReactiveUI.Blazor.csproj
index 4c3aba1323..82d815a42c 100644
--- a/src/ReactiveUI.Blazor/ReactiveUI.Blazor.csproj
+++ b/src/ReactiveUI.Blazor/ReactiveUI.Blazor.csproj
@@ -3,6 +3,8 @@
netstandard2.0
Contains the ReactiveUI platform specific extensions for Blazor
mvvm;reactiveui;rx;reactive extensions;observable;LINQ;eventsnet;netstandard;blazor;web;
+ enable
+ latest
diff --git a/src/ReactiveUI.Blend/FollowObservableStateBehavior.cs b/src/ReactiveUI.Blend/FollowObservableStateBehavior.cs
index 7c7a82e5f9..75e1e5c2aa 100644
--- a/src/ReactiveUI.Blend/FollowObservableStateBehavior.cs
+++ b/src/ReactiveUI.Blend/FollowObservableStateBehavior.cs
@@ -28,7 +28,7 @@ public class FollowObservableStateBehavior : Behavior
public class FollowObservableStateBehavior : Behavior
#endif
{
- private IDisposable _watcher;
+ private IDisposable? _watcher;
///
/// Gets or sets the state observable.
@@ -40,7 +40,7 @@ public IObservable StateObservable
}
///
- /// The state observable depdendency property.
+ /// The state observable dependency property.
///
public static readonly DependencyProperty StateObservableProperty =
DependencyProperty.Register("StateObservable", typeof(IObservable), typeof(FollowObservableStateBehavior), new PropertyMetadata(null, OnStateObservableChanged));
diff --git a/src/ReactiveUI.Blend/Platforms/net4/ObservableTrigger.cs b/src/ReactiveUI.Blend/Platforms/net4/ObservableTrigger.cs
index bc03e7d8a7..29f7a21bee 100644
--- a/src/ReactiveUI.Blend/Platforms/net4/ObservableTrigger.cs
+++ b/src/ReactiveUI.Blend/Platforms/net4/ObservableTrigger.cs
@@ -24,7 +24,7 @@ public class ObservableTrigger : TriggerBase
public static readonly DependencyProperty ObservableProperty =
DependencyProperty.Register("Observable", typeof(IObservable
- public static ObservableAsPropertyHelper ToPropertyEx(this IObservable item, TObj source, Expression> property, TRet initialValue = default, bool deferSubscription = false, IScheduler scheduler = null)
+ public static ObservableAsPropertyHelper ToPropertyEx(this IObservable item, TObj source, Expression> property, TRet initialValue = default, bool deferSubscription = false, IScheduler? scheduler = null)
where TObj : ReactiveObject
{
if (item == null)
diff --git a/src/ReactiveUI.Fody.Helpers/ReactiveDependencyAttribute.cs b/src/ReactiveUI.Fody.Helpers/ReactiveDependencyAttribute.cs
index e87fb7e16b..9e2a2b193f 100644
--- a/src/ReactiveUI.Fody.Helpers/ReactiveDependencyAttribute.cs
+++ b/src/ReactiveUI.Fody.Helpers/ReactiveDependencyAttribute.cs
@@ -35,6 +35,6 @@ public ReactiveDependencyAttribute(string targetName)
///
/// Gets or sets the target property on the backing property.
///
- public string TargetProperty { get; set; }
+ public string? TargetProperty { get; set; }
}
}
diff --git a/src/ReactiveUI.Fody.Helpers/ReactiveUI.Fody.Helpers.csproj b/src/ReactiveUI.Fody.Helpers/ReactiveUI.Fody.Helpers.csproj
index 5e4299a3ad..6e14038a22 100644
--- a/src/ReactiveUI.Fody.Helpers/ReactiveUI.Fody.Helpers.csproj
+++ b/src/ReactiveUI.Fody.Helpers/ReactiveUI.Fody.Helpers.csproj
@@ -12,6 +12,7 @@
false
+ enable
latest
diff --git a/src/ReactiveUI.Fody.Tests/API/ApiApprovalTests.ReactiveUIFody.net461.approved.txt b/src/ReactiveUI.Fody.Tests/API/ApiApprovalTests.ReactiveUIFody.net461.approved.txt
index a019371da0..f5e35983fc 100644
--- a/src/ReactiveUI.Fody.Tests/API/ApiApprovalTests.ReactiveUIFody.net461.approved.txt
+++ b/src/ReactiveUI.Fody.Tests/API/ApiApprovalTests.ReactiveUIFody.net461.approved.txt
@@ -13,7 +13,7 @@ namespace ReactiveUI.Fody.Helpers
}
public static class ObservableAsPropertyExtensions
{
- public static ReactiveUI.ObservableAsPropertyHelper ToPropertyEx(this System.IObservable item, TObj source, System.Linq.Expressions.Expression> property, TRet initialValue = default, bool deferSubscription = false, System.Reactive.Concurrency.IScheduler scheduler = null)
+ public static ReactiveUI.ObservableAsPropertyHelper ToPropertyEx(this System.IObservable item, TObj source, System.Linq.Expressions.Expression> property, TRet initialValue = default, bool deferSubscription = false, System.Reactive.Concurrency.IScheduler? scheduler = null)
where TObj : ReactiveUI.ReactiveObject { }
}
[System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.All)]
@@ -26,6 +26,6 @@ namespace ReactiveUI.Fody.Helpers
{
public ReactiveDependencyAttribute(string targetName) { }
public string Target { get; }
- public string TargetProperty { get; set; }
+ public string? TargetProperty { get; set; }
}
}
\ No newline at end of file
diff --git a/src/ReactiveUI.Fody.Tests/API/ApiApprovalTests.ReactiveUIFody.netcoreapp3.1.approved.txt b/src/ReactiveUI.Fody.Tests/API/ApiApprovalTests.ReactiveUIFody.netcoreapp3.1.approved.txt
index 1af8ba5cdb..bea9ef126e 100644
--- a/src/ReactiveUI.Fody.Tests/API/ApiApprovalTests.ReactiveUIFody.netcoreapp3.1.approved.txt
+++ b/src/ReactiveUI.Fody.Tests/API/ApiApprovalTests.ReactiveUIFody.netcoreapp3.1.approved.txt
@@ -13,7 +13,7 @@ namespace ReactiveUI.Fody.Helpers
}
public static class ObservableAsPropertyExtensions
{
- public static ReactiveUI.ObservableAsPropertyHelper ToPropertyEx(this System.IObservable item, TObj source, System.Linq.Expressions.Expression> property, TRet initialValue = default, bool deferSubscription = false, System.Reactive.Concurrency.IScheduler scheduler = null)
+ public static ReactiveUI.ObservableAsPropertyHelper ToPropertyEx(this System.IObservable item, TObj source, System.Linq.Expressions.Expression> property, TRet initialValue = default, bool deferSubscription = false, System.Reactive.Concurrency.IScheduler? scheduler = null)
where TObj : ReactiveUI.ReactiveObject { }
}
[System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.All)]
@@ -26,6 +26,6 @@ namespace ReactiveUI.Fody.Helpers
{
public ReactiveDependencyAttribute(string targetName) { }
public string Target { get; }
- public string TargetProperty { get; set; }
+ public string? TargetProperty { get; set; }
}
}
\ No newline at end of file
diff --git a/src/ReactiveUI.Fody.Tests/ApiApprovalBase.cs b/src/ReactiveUI.Fody.Tests/ApiApprovalBase.cs
index 2f326c0827..60b204c4d7 100644
--- a/src/ReactiveUI.Fody.Tests/ApiApprovalBase.cs
+++ b/src/ReactiveUI.Fody.Tests/ApiApprovalBase.cs
@@ -25,31 +25,34 @@ public abstract class ApiApprovalBase
{
private static readonly Regex _removeCoverletSectionRegex = new Regex(@"^namespace Coverlet\.Core\.Instrumentation\.Tracker.*?^}", RegexOptions.Singleline | RegexOptions.Multiline | RegexOptions.Compiled);
- protected static void CheckApproval(Assembly assembly, [CallerMemberName]string memberName = null, [CallerFilePath]string filePath = null)
+ protected static void CheckApproval(Assembly assembly, [CallerMemberName]string? memberName = null, [CallerFilePath]string? filePath = null)
{
var targetFrameworkName = Assembly.GetExecutingAssembly().GetTargetFrameworkName();
var sourceDirectory = Path.GetDirectoryName(filePath);
- var approvedFileName = Path.Combine(sourceDirectory, $"ApiApprovalTests.{memberName}.{targetFrameworkName}.approved.txt");
- var receivedFileName = Path.Combine(sourceDirectory, $"ApiApprovalTests.{memberName}.{targetFrameworkName}.received.txt");
+ if (sourceDirectory != null)
+ {
+ var approvedFileName = Path.Combine(sourceDirectory, $"ApiApprovalTests.{memberName}.{targetFrameworkName}.approved.txt");
+ var receivedFileName = Path.Combine(sourceDirectory, $"ApiApprovalTests.{memberName}.{targetFrameworkName}.received.txt");
- string approvedPublicApi = string.Empty;
+ string approvedPublicApi = string.Empty;
- if (File.Exists(approvedFileName))
- {
- approvedPublicApi = File.ReadAllText(approvedFileName);
- }
+ if (File.Exists(approvedFileName))
+ {
+ approvedPublicApi = File.ReadAllText(approvedFileName);
+ }
- var receivedPublicApi = Filter(ApiGenerator.GeneratePublicApi(assembly, new ApiGeneratorOptions()));
+ var receivedPublicApi = Filter(ApiGenerator.GeneratePublicApi(assembly, new ApiGeneratorOptions()));
- if (!string.Equals(receivedPublicApi, approvedPublicApi, StringComparison.InvariantCulture))
- {
- File.WriteAllText(receivedFileName, receivedPublicApi);
- ShouldlyConfiguration.DiffTools.GetDiffTool().Open(receivedFileName, approvedFileName, true);
- }
+ if (!string.Equals(receivedPublicApi, approvedPublicApi, StringComparison.InvariantCulture))
+ {
+ File.WriteAllText(receivedFileName, receivedPublicApi);
+ ShouldlyConfiguration.DiffTools.GetDiffTool().Open(receivedFileName, approvedFileName, true);
+ }
- Assert.Equal(approvedPublicApi, receivedPublicApi);
+ Assert.Equal(approvedPublicApi, receivedPublicApi);
+ }
}
private static string Filter(string text)
diff --git a/src/ReactiveUI.Fody.Tests/FodyWeavers.xsd b/src/ReactiveUI.Fody.Tests/FodyWeavers.xsd
index 5cedd530b9..f3ac47620a 100644
--- a/src/ReactiveUI.Fody.Tests/FodyWeavers.xsd
+++ b/src/ReactiveUI.Fody.Tests/FodyWeavers.xsd
@@ -4,7 +4,6 @@
-
diff --git a/src/ReactiveUI.Fody.Tests/Issues/Issue10Tests.cs b/src/ReactiveUI.Fody.Tests/Issues/Issue10Tests.cs
index 867f6a12ca..b5e0f10c36 100644
--- a/src/ReactiveUI.Fody.Tests/Issues/Issue10Tests.cs
+++ b/src/ReactiveUI.Fody.Tests/Issues/Issue10Tests.cs
@@ -28,7 +28,7 @@ public TestModel()
}
[ObservableAsProperty]
- public string MyProperty { get; private set; }
+ public string? MyProperty { get; private set; }
[ObservableAsProperty]
public int MyIntProperty { get; private set; }
@@ -36,7 +36,7 @@ public TestModel()
[ObservableAsProperty]
public DateTime MyDateTimeProperty { get; private set; }
- public string OtherProperty { get; private set; }
+ public string? OtherProperty { get; private set; }
}
}
}
diff --git a/src/ReactiveUI.Fody.Tests/Mocks/BaseModel.cs b/src/ReactiveUI.Fody.Tests/Mocks/BaseModel.cs
index c98fdf1e4a..08223fc741 100644
--- a/src/ReactiveUI.Fody.Tests/Mocks/BaseModel.cs
+++ b/src/ReactiveUI.Fody.Tests/Mocks/BaseModel.cs
@@ -15,6 +15,6 @@ public class BaseModel : ReactiveObject
{
public virtual int IntProperty { get; set; } = 5;
- public virtual string StringProperty { get; set; } = "Initial Value";
+ public virtual string? StringProperty { get; set; } = "Initial Value";
}
}
diff --git a/src/ReactiveUI.Fody.Tests/Mocks/DecoratorModel.cs b/src/ReactiveUI.Fody.Tests/Mocks/DecoratorModel.cs
index 97f6d4b426..469be4ca40 100644
--- a/src/ReactiveUI.Fody.Tests/Mocks/DecoratorModel.cs
+++ b/src/ReactiveUI.Fody.Tests/Mocks/DecoratorModel.cs
@@ -28,11 +28,11 @@ public DecoratorModel(BaseModel baseModel)
}
[Reactive]
- public string SomeCoolNewProperty { get; set; }
+ public string? SomeCoolNewProperty { get; set; }
// Works with private fields
[ReactiveDependency(nameof(_model))]
- public override string StringProperty { get; set; }
+ public override string? StringProperty { get; set; }
// Can't be attributed as has additional functionality in the decorated get
public override int IntProperty
diff --git a/src/ReactiveUI.Fody.Tests/Mocks/FacadeModel.cs b/src/ReactiveUI.Fody.Tests/Mocks/FacadeModel.cs
index afb84771ec..da881cd18d 100644
--- a/src/ReactiveUI.Fody.Tests/Mocks/FacadeModel.cs
+++ b/src/ReactiveUI.Fody.Tests/Mocks/FacadeModel.cs
@@ -38,6 +38,6 @@ public BaseModel Dependency
// Property named differently to that on the dependency but still pass through value
[ReactiveDependency(nameof(Dependency), TargetProperty = "StringProperty")]
- public string AnotherStringProperty { get; set; }
+ public string? AnotherStringProperty { get; set; }
}
}
diff --git a/src/ReactiveUI.Fody.Tests/Mocks/ObservableAsTestModel.cs b/src/ReactiveUI.Fody.Tests/Mocks/ObservableAsTestModel.cs
index 42a06877ef..a294c8f36b 100644
--- a/src/ReactiveUI.Fody.Tests/Mocks/ObservableAsTestModel.cs
+++ b/src/ReactiveUI.Fody.Tests/Mocks/ObservableAsTestModel.cs
@@ -21,6 +21,6 @@ public ObservableAsTestModel()
}
[ObservableAsProperty]
- public string TestProperty { get; private set; }
+ public string? TestProperty { get; private set; }
}
}
diff --git a/src/ReactiveUI.Fody.Tests/ReactiveUI.Fody.Tests.csproj b/src/ReactiveUI.Fody.Tests/ReactiveUI.Fody.Tests.csproj
index 8b03d993d7..b7c48d0f86 100644
--- a/src/ReactiveUI.Fody.Tests/ReactiveUI.Fody.Tests.csproj
+++ b/src/ReactiveUI.Fody.Tests/ReactiveUI.Fody.Tests.csproj
@@ -4,6 +4,7 @@
$(TargetFrameworks);net461
netstandard2.0
$(TargetFramework)
+ enable
latest
diff --git a/src/ReactiveUI.Fody/CecilExtensions.cs b/src/ReactiveUI.Fody/CecilExtensions.cs
index e507923e4a..aa22cabd3f 100644
--- a/src/ReactiveUI.Fody/CecilExtensions.cs
+++ b/src/ReactiveUI.Fody/CecilExtensions.cs
@@ -67,7 +67,7 @@ public static GenericInstanceMethod MakeGenericMethod(this MethodReference metho
///
/// true if [is assignable from] [the specified type]; otherwise, false.
///
- public static bool IsAssignableFrom(this TypeReference baseType, TypeReference type, Action logger = null)
+ public static bool IsAssignableFrom(this TypeReference baseType, TypeReference type, Action? logger = null)
{
if (baseType == null)
{
@@ -91,9 +91,9 @@ public static bool IsAssignableFrom(this TypeReference baseType, TypeReference t
///
/// true if [is assignable from] [the specified type]; otherwise, false.
///
- public static bool IsAssignableFrom(this TypeDefinition baseType, TypeDefinition type, Action logger = null)
+ public static bool IsAssignableFrom(this TypeDefinition baseType, TypeDefinition type, Action? logger = null)
{
- logger = logger ?? (x => { });
+ logger ??= x => { };
Queue queue = new Queue();
queue.Enqueue(type);
@@ -226,7 +226,7 @@ public static AssemblyNameReference FindAssembly(this ModuleDefinition currentMo
/// The scope.
/// The type parameters.
/// The type reference.
- public static TypeReference FindType(this ModuleDefinition currentModule, string @namespace, string typeName, IMetadataScope scope = null, params string[] typeParameters)
+ public static TypeReference FindType(this ModuleDefinition currentModule, string @namespace, string typeName, IMetadataScope? scope = null, params string[] typeParameters)
{
if (typeParameters == null)
{
diff --git a/src/ReactiveUI.Fody/ModuleWeaver.cs b/src/ReactiveUI.Fody/ModuleWeaver.cs
index 62b722210f..a93953a93e 100644
--- a/src/ReactiveUI.Fody/ModuleWeaver.cs
+++ b/src/ReactiveUI.Fody/ModuleWeaver.cs
@@ -20,24 +20,24 @@ public override void Execute()
var propertyWeaver = new ReactiveUIPropertyWeaver
{
ModuleDefinition = ModuleDefinition,
- LogInfo = LogInfo,
- LogError = LogError
+ LogInfo = WriteInfo,
+ LogError = WriteError
};
propertyWeaver.Execute();
var observableAsPropertyWeaver = new ObservableAsPropertyWeaver
{
ModuleDefinition = ModuleDefinition,
- LogInfo = LogInfo,
- FindType = FindType
+ LogInfo = WriteInfo,
+ FindType = FindTypeDefinition
};
observableAsPropertyWeaver.Execute();
var reactiveDependencyWeaver = new ReactiveDependencyPropertyWeaver
{
ModuleDefinition = ModuleDefinition,
- LogInfo = LogInfo,
- LogError = LogError
+ LogInfo = WriteInfo,
+ LogError = WriteError
};
reactiveDependencyWeaver.Execute();
}
diff --git a/src/ReactiveUI.Fody/ObservableAsPropertyWeaver.cs b/src/ReactiveUI.Fody/ObservableAsPropertyWeaver.cs
index 0482060df6..cb17f2b310 100644
--- a/src/ReactiveUI.Fody/ObservableAsPropertyWeaver.cs
+++ b/src/ReactiveUI.Fody/ObservableAsPropertyWeaver.cs
@@ -22,7 +22,7 @@ public class ObservableAsPropertyWeaver
///
/// The module definition.
///
- public ModuleDefinition ModuleDefinition { get; set; }
+ public ModuleDefinition? ModuleDefinition { get; set; }
///
/// Gets or sets a action that will log an MessageImportance.High message to MSBuild. OPTIONAL.
@@ -30,93 +30,96 @@ public class ObservableAsPropertyWeaver
///
/// The log information.
///
- public Action LogInfo { get; set; }
+ public Action? LogInfo { get; set; }
///
/// Gets a function that will find a type from referenced assemblies by name.
///
- public Func FindType { get; internal set; }
+ public Func? FindType { get; internal set; }
///
/// Executes this property weaver.
///
public void Execute()
{
- var reactiveUI = ModuleDefinition.AssemblyReferences.Where(x => x.Name == "ReactiveUI").OrderByDescending(x => x.Version).FirstOrDefault();
+ var reactiveUI = ModuleDefinition?.AssemblyReferences.Where(x => x.Name == "ReactiveUI").OrderByDescending(x => x.Version).FirstOrDefault();
if (reactiveUI == null)
{
- LogInfo("Could not find assembly: ReactiveUI (" + string.Join(", ", ModuleDefinition.AssemblyReferences.Select(x => x.Name)) + ")");
+ LogInfo?.Invoke("Could not find assembly: ReactiveUI (" + string.Join(", ", ModuleDefinition?.AssemblyReferences.Select(x => x.Name)) + ")");
return;
}
- LogInfo($"{reactiveUI.Name} {reactiveUI.Version}");
- var helpers = ModuleDefinition.AssemblyReferences.Where(x => x.Name == "ReactiveUI.Fody.Helpers").OrderByDescending(x => x.Version).FirstOrDefault();
+ LogInfo?.Invoke($"{reactiveUI.Name} {reactiveUI.Version}");
+ var helpers = ModuleDefinition?.AssemblyReferences.Where(x => x.Name == "ReactiveUI.Fody.Helpers").OrderByDescending(x => x.Version).FirstOrDefault();
if (helpers == null)
{
- LogInfo("Could not find assembly: ReactiveUI.Fody.Helpers (" + string.Join(", ", ModuleDefinition.AssemblyReferences.Select(x => x.Name)) + ")");
+ LogInfo?.Invoke("Could not find assembly: ReactiveUI.Fody.Helpers (" + string.Join(", ", ModuleDefinition?.AssemblyReferences.Select(x => x.Name)) + ")");
return;
}
- LogInfo($"{helpers.Name} {helpers.Version}");
+ LogInfo?.Invoke($"{helpers.Name} {helpers.Version}");
- var reactiveObject = ModuleDefinition.FindType("ReactiveUI", "ReactiveObject", reactiveUI);
+ if (ModuleDefinition != null)
+ {
+ var reactiveObject = ModuleDefinition.FindType("ReactiveUI", "ReactiveObject", reactiveUI);
- // The types we will scan are subclasses of ReactiveObject
- var targetTypes = ModuleDefinition.GetAllTypes().Where(x => x.BaseType != null && reactiveObject.IsAssignableFrom(x.BaseType));
+ // The types we will scan are subclasses of ReactiveObject
+ var targetTypes = ModuleDefinition.GetAllTypes().Where(x => x.BaseType != null && reactiveObject.IsAssignableFrom(x.BaseType));
- var observableAsPropertyHelper = ModuleDefinition.FindType("ReactiveUI", "ObservableAsPropertyHelper`1", reactiveUI, "T");
- var observableAsPropertyAttribute = ModuleDefinition.FindType("ReactiveUI.Fody.Helpers", "ObservableAsPropertyAttribute", helpers);
- var observableAsPropertyHelperGetValue = ModuleDefinition.ImportReference(observableAsPropertyHelper.Resolve().Properties.Single(x => x.Name == "Value").GetMethod);
- var exceptionDefinition = FindType(typeof(Exception).FullName);
- var constructorDefinition = exceptionDefinition.GetConstructors().Single(x => x.Parameters.Count == 1);
- var exceptionConstructor = ModuleDefinition.ImportReference(constructorDefinition);
+ var observableAsPropertyHelper = ModuleDefinition.FindType("ReactiveUI", "ObservableAsPropertyHelper`1", reactiveUI, "T");
+ var observableAsPropertyAttribute = ModuleDefinition.FindType("ReactiveUI.Fody.Helpers", "ObservableAsPropertyAttribute", helpers);
+ var observableAsPropertyHelperGetValue = ModuleDefinition.ImportReference(observableAsPropertyHelper.Resolve().Properties.Single(x => x.Name == "Value").GetMethod);
+ var exceptionDefinition = FindType?.Invoke(typeof(Exception).FullName);
+ var constructorDefinition = exceptionDefinition.GetConstructors().Single(x => x.Parameters.Count == 1);
+ var exceptionConstructor = ModuleDefinition.ImportReference(constructorDefinition);
- foreach (var targetType in targetTypes)
- {
- foreach (var property in targetType.Properties.Where(x => x.IsDefined(observableAsPropertyAttribute) || (x.GetMethod?.IsDefined(observableAsPropertyAttribute) ?? false)).ToArray())
+ foreach (var targetType in targetTypes)
{
- var genericObservableAsPropertyHelper = observableAsPropertyHelper.MakeGenericInstanceType(property.PropertyType);
- var genericObservableAsPropertyHelperGetValue = observableAsPropertyHelperGetValue.Bind(genericObservableAsPropertyHelper);
- ModuleDefinition.ImportReference(genericObservableAsPropertyHelperGetValue);
+ foreach (var property in targetType.Properties.Where(x => x.IsDefined(observableAsPropertyAttribute) || (x.GetMethod?.IsDefined(observableAsPropertyAttribute) ?? false)).ToArray())
+ {
+ var genericObservableAsPropertyHelper = observableAsPropertyHelper.MakeGenericInstanceType(property.PropertyType);
+ var genericObservableAsPropertyHelperGetValue = observableAsPropertyHelperGetValue.Bind(genericObservableAsPropertyHelper);
+ ModuleDefinition.ImportReference(genericObservableAsPropertyHelperGetValue);
- // Declare a field to store the property value
- var field = new FieldDefinition("$" + property.Name, FieldAttributes.Private, genericObservableAsPropertyHelper);
- targetType.Fields.Add(field);
+ // Declare a field to store the property value
+ var field = new FieldDefinition("$" + property.Name, FieldAttributes.Private, genericObservableAsPropertyHelper);
+ targetType.Fields.Add(field);
- // It's an auto-property, so remove the generated field
- if (property.SetMethod != null && property.SetMethod.HasBody)
- {
- // Remove old field (the generated backing field for the auto property)
- var oldField = (FieldReference)property.GetMethod.Body.Instructions.Where(x => x.Operand is FieldReference).Single().Operand;
- var oldFieldDefinition = oldField.Resolve();
- targetType.Fields.Remove(oldFieldDefinition);
-
- // Re-implement setter to throw an exception
- property.SetMethod.Body = new MethodBody(property.SetMethod);
- property.SetMethod.Body.Emit(il =>
+ // It's an auto-property, so remove the generated field
+ if (property.SetMethod != null && property.SetMethod.HasBody)
{
- il.Emit(OpCodes.Ldstr, "Never call the setter of an ObservabeAsPropertyHelper property.");
- il.Emit(OpCodes.Newobj, exceptionConstructor);
- il.Emit(OpCodes.Throw);
- il.Emit(OpCodes.Ret);
+ // Remove old field (the generated backing field for the auto property)
+ var oldField = (FieldReference)property.GetMethod.Body.Instructions.Where(x => x.Operand is FieldReference).Single().Operand;
+ var oldFieldDefinition = oldField.Resolve();
+ targetType.Fields.Remove(oldFieldDefinition);
+
+ // Re-implement setter to throw an exception
+ property.SetMethod.Body = new MethodBody(property.SetMethod);
+ property.SetMethod.Body.Emit(il =>
+ {
+ il.Emit(OpCodes.Ldstr, "Never call the setter of an ObservabeAsPropertyHelper property.");
+ il.Emit(OpCodes.Newobj, exceptionConstructor);
+ il.Emit(OpCodes.Throw);
+ il.Emit(OpCodes.Ret);
+ });
+ }
+
+ property.GetMethod.Body = new MethodBody(property.GetMethod);
+ property.GetMethod.Body.Emit(il =>
+ {
+ var isValid = il.Create(OpCodes.Nop);
+ il.Emit(OpCodes.Ldarg_0); // this
+ il.Emit(OpCodes.Ldfld, field.BindDefinition(targetType)); // pop -> this.$PropertyName
+ il.Emit(OpCodes.Dup); // Put an extra copy of this.$PropertyName onto the stack
+ il.Emit(OpCodes.Brtrue, isValid); // If the helper is null, return the default value for the property
+ il.Emit(OpCodes.Pop); // Drop this.$PropertyName
+ EmitDefaultValue(property.GetMethod.Body, il, property.PropertyType); // Put the default value onto the stack
+ il.Emit(OpCodes.Ret); // Return that default value
+ il.Append(isValid); // Add a marker for if the helper is not null
+ il.Emit(OpCodes.Callvirt, genericObservableAsPropertyHelperGetValue); // pop -> this.$PropertyName.Value
+ il.Emit(OpCodes.Ret); // Return the value that is on the stack
});
}
-
- property.GetMethod.Body = new MethodBody(property.GetMethod);
- property.GetMethod.Body.Emit(il =>
- {
- var isValid = il.Create(OpCodes.Nop);
- il.Emit(OpCodes.Ldarg_0); // this
- il.Emit(OpCodes.Ldfld, field.BindDefinition(targetType)); // pop -> this.$PropertyName
- il.Emit(OpCodes.Dup); // Put an extra copy of this.$PropertyName onto the stack
- il.Emit(OpCodes.Brtrue, isValid); // If the helper is null, return the default value for the property
- il.Emit(OpCodes.Pop); // Drop this.$PropertyName
- EmitDefaultValue(property.GetMethod.Body, il, property.PropertyType); // Put the default value onto the stack
- il.Emit(OpCodes.Ret); // Return that default value
- il.Append(isValid); // Add a marker for if the helper is not null
- il.Emit(OpCodes.Callvirt, genericObservableAsPropertyHelperGetValue); // pop -> this.$PropertyName.Value
- il.Emit(OpCodes.Ret); // Return the value that is on the stack
- });
}
}
}
@@ -139,35 +142,38 @@ public void EmitDefaultValue(MethodBody methodBody, ILProcessor il, TypeReferenc
throw new ArgumentNullException(nameof(il));
}
- if (type.CompareTo(ModuleDefinition.TypeSystem.Boolean) || type.CompareTo(ModuleDefinition.TypeSystem.Byte) ||
- type.CompareTo(ModuleDefinition.TypeSystem.Int16) || type.CompareTo(ModuleDefinition.TypeSystem.Int32))
- {
- il.Emit(OpCodes.Ldc_I4_0);
- }
- else if (type.CompareTo(ModuleDefinition.TypeSystem.Single))
- {
- il.Emit(OpCodes.Ldc_R4, 0F);
- }
- else if (type.CompareTo(ModuleDefinition.TypeSystem.Int64))
- {
- il.Emit(OpCodes.Ldc_I8);
- }
- else if (type.CompareTo(ModuleDefinition.TypeSystem.Double))
- {
- il.Emit(OpCodes.Ldc_R8, 0D);
- }
- else if (type.IsGenericParameter || type.IsValueType)
+ if (ModuleDefinition != null)
{
- methodBody.InitLocals = true;
- var local = new VariableDefinition(type);
- il.Body.Variables.Add(local);
- il.Emit(OpCodes.Ldloca_S, local);
- il.Emit(OpCodes.Initobj, type);
- il.Emit(OpCodes.Ldloc, local);
- }
- else
- {
- il.Emit(OpCodes.Ldnull);
+ if (type.CompareTo(ModuleDefinition.TypeSystem.Boolean) || type.CompareTo(ModuleDefinition.TypeSystem.Byte) ||
+ type.CompareTo(ModuleDefinition.TypeSystem.Int16) || type.CompareTo(ModuleDefinition.TypeSystem.Int32))
+ {
+ il.Emit(OpCodes.Ldc_I4_0);
+ }
+ else if (type.CompareTo(ModuleDefinition.TypeSystem.Single))
+ {
+ il.Emit(OpCodes.Ldc_R4, 0F);
+ }
+ else if (type.CompareTo(ModuleDefinition.TypeSystem.Int64))
+ {
+ il.Emit(OpCodes.Ldc_I8);
+ }
+ else if (type.CompareTo(ModuleDefinition.TypeSystem.Double))
+ {
+ il.Emit(OpCodes.Ldc_R8, 0D);
+ }
+ else if (type.IsGenericParameter || type.IsValueType)
+ {
+ methodBody.InitLocals = true;
+ var local = new VariableDefinition(type);
+ il.Body.Variables.Add(local);
+ il.Emit(OpCodes.Ldloca_S, local);
+ il.Emit(OpCodes.Initobj, type);
+ il.Emit(OpCodes.Ldloc, local);
+ }
+ else
+ {
+ il.Emit(OpCodes.Ldnull);
+ }
}
}
}
diff --git a/src/ReactiveUI.Fody/ReactiveDependencyPropertyWeaver.cs b/src/ReactiveUI.Fody/ReactiveDependencyPropertyWeaver.cs
index d140fa1a44..dd8f6e0ac5 100644
--- a/src/ReactiveUI.Fody/ReactiveDependencyPropertyWeaver.cs
+++ b/src/ReactiveUI.Fody/ReactiveDependencyPropertyWeaver.cs
@@ -22,7 +22,7 @@ public class ReactiveDependencyPropertyWeaver
///
/// The module definition.
///
- public ModuleDefinition ModuleDefinition { get; set; }
+ public ModuleDefinition? ModuleDefinition { get; set; }
///
/// Gets or sets a action that will log an MessageImportance.High message to MSBuild. OPTIONAL.
@@ -30,7 +30,7 @@ public class ReactiveDependencyPropertyWeaver
///
/// The log information.
///
- public Action LogInfo { get; set; }
+ public Action? LogInfo { get; set; }
///
/// Gets or sets a action which will log an error message to MSBuild. OPTIONAL.
@@ -38,7 +38,7 @@ public class ReactiveDependencyPropertyWeaver
///
/// The log error.
///
- public Action LogError { get; set; }
+ public Action? LogError { get; set; }
///
/// Executes this instance.
@@ -52,22 +52,22 @@ public class ReactiveDependencyPropertyWeaver
///
public void Execute()
{
- var reactiveUI = ModuleDefinition.AssemblyReferences.Where(x => x.Name == "ReactiveUI").OrderByDescending(x => x.Version).FirstOrDefault();
+ var reactiveUI = ModuleDefinition?.AssemblyReferences.Where(x => x.Name == "ReactiveUI").OrderByDescending(x => x.Version).FirstOrDefault();
if (reactiveUI == null)
{
- LogInfo("Could not find assembly: ReactiveUI (" + string.Join(", ", ModuleDefinition.AssemblyReferences.Select(x => x.Name)) + ")");
+ LogInfo?.Invoke("Could not find assembly: ReactiveUI (" + string.Join(", ", ModuleDefinition?.AssemblyReferences.Select(x => x.Name)) + ")");
return;
}
- LogInfo($"{reactiveUI.Name} {reactiveUI.Version}");
- var helpers = ModuleDefinition.AssemblyReferences.Where(x => x.Name == "ReactiveUI.Fody.Helpers").OrderByDescending(x => x.Version).FirstOrDefault();
+ LogInfo?.Invoke($"{reactiveUI.Name} {reactiveUI.Version}");
+ var helpers = ModuleDefinition?.AssemblyReferences.Where(x => x.Name == "ReactiveUI.Fody.Helpers").OrderByDescending(x => x.Version).FirstOrDefault();
if (helpers == null)
{
- LogInfo("Could not find assembly: ReactiveUI.Fody.Helpers (" + string.Join(", ", ModuleDefinition.AssemblyReferences.Select(x => x.Name)) + ")");
+ LogInfo?.Invoke("Could not find assembly: ReactiveUI.Fody.Helpers (" + string.Join(", ", ModuleDefinition?.AssemblyReferences.Select(x => x.Name)) + ")");
return;
}
- LogInfo($"{helpers.Name} {helpers.Version}");
+ LogInfo?.Invoke($"{helpers.Name} {helpers.Version}");
var reactiveObject = new TypeReference("ReactiveUI", "IReactiveObject", ModuleDefinition, reactiveUI);
var targetTypes = ModuleDefinition.GetAllTypes().Where(x => x.BaseType != null && reactiveObject.IsAssignableFrom(x.BaseType)).ToArray();
@@ -77,13 +77,13 @@ public void Execute()
throw new Exception("reactiveObjectExtensions is null");
}
- var raisePropertyChangedMethod = ModuleDefinition.ImportReference(reactiveObjectExtensions.Methods.Single(x => x.Name == "RaisePropertyChanged"));
+ var raisePropertyChangedMethod = ModuleDefinition?.ImportReference(reactiveObjectExtensions.Methods.Single(x => x.Name == "RaisePropertyChanged"));
if (raisePropertyChangedMethod == null)
{
throw new Exception("raisePropertyChangedMethod is null");
}
- var reactiveDependencyAttribute = ModuleDefinition.FindType("ReactiveUI.Fody.Helpers", "ReactiveDependencyAttribute", helpers);
+ var reactiveDependencyAttribute = ModuleDefinition?.FindType("ReactiveUI.Fody.Helpers", "ReactiveDependencyAttribute", helpers);
if (reactiveDependencyAttribute == null)
{
throw new Exception("reactiveDecoratorAttribute is null");
@@ -96,7 +96,7 @@ public void Execute()
// If the property already has a body then do not weave to prevent loss of instructions
if (!facadeProperty.GetMethod.Body.Instructions.Any(x => x.Operand is FieldReference) || facadeProperty.GetMethod.Body.HasVariables)
{
- LogError($"Property {facadeProperty.Name} is not an auto property and therefore not suitable for ReactiveDependency weaving");
+ LogError?.Invoke($"Property {facadeProperty.Name} is not an auto property and therefore not suitable for ReactiveDependency weaving");
continue;
}
@@ -106,13 +106,13 @@ public void Execute()
var targetValue = targetNamedArgument.Value?.ToString();
if (string.IsNullOrEmpty(targetValue))
{
- LogError("No target property defined on the object");
+ LogError?.Invoke("No target property defined on the object");
continue;
}
if (targetType.Properties.All(x => x.Name != targetValue) && targetType.Fields.All(x => x.Name != targetValue))
{
- LogError($"dependency object property/field name '{targetValue}' not found on target type {targetType.Name}");
+ LogError?.Invoke($"dependency object property/field name '{targetValue}' not found on target type {targetType.Name}");
continue;
}
@@ -125,7 +125,7 @@ public void Execute()
if (objDependencyTargetType == null)
{
- LogError("Couldn't result the dependency type");
+ LogError?.Invoke("Couldn't result the dependency type");
continue;
}
@@ -141,7 +141,7 @@ public void Execute()
if (objDependencyTargetType.Properties.All(x => x.Name != destinationPropertyName))
{
- LogError($"Target property {destinationPropertyName} on dependency of type {objDependencyTargetType.DeclaringType.Name} not found");
+ LogError?.Invoke($"Target property {destinationPropertyName} on dependency of type {objDependencyTargetType.DeclaringType.Name} not found");
continue;
}
@@ -150,14 +150,14 @@ public void Execute()
// The property on the facade/decorator should have a setter
if (facadeProperty.SetMethod == null)
{
- LogError($"Property {facadeProperty.DeclaringType.FullName}.{facadeProperty.Name} has no setter, therefore it is not possible for the property to change, and thus should not be marked with [ReactiveDecorator]");
+ LogError?.Invoke($"Property {facadeProperty.DeclaringType.FullName}.{facadeProperty.Name} has no setter, therefore it is not possible for the property to change, and thus should not be marked with [ReactiveDecorator]");
continue;
}
// The property on the dependency should have a setter e.g. Dependency.SomeProperty = value;
if (destinationProperty.SetMethod == null)
{
- LogError($"Dependency object's property {destinationProperty.DeclaringType.FullName}.{destinationProperty.Name} has no setter, therefore it is not possible for the property to change, and thus should not be marked with [ReactiveDecorator]");
+ LogError?.Invoke($"Dependency object's property {destinationProperty.DeclaringType.FullName}.{destinationProperty.Name} has no setter, therefore it is not possible for the property to change, and thus should not be marked with [ReactiveDecorator]");
continue;
}
diff --git a/src/ReactiveUI.Fody/ReactiveUI.Fody.csproj b/src/ReactiveUI.Fody/ReactiveUI.Fody.csproj
index 10ced0fe99..4d254be499 100644
--- a/src/ReactiveUI.Fody/ReactiveUI.Fody.csproj
+++ b/src/ReactiveUI.Fody/ReactiveUI.Fody.csproj
@@ -4,6 +4,7 @@
$(TargetFrameworks);net461
Fody extension that will generate RaisePropertyChange notifications for properties and ObservableAsPropertyHelper properties
False
+ enable
latest
mvvm;reactiveui;rx;reactive extensions;observable;LINQ;events;frp;xamarin;android;ios;mac;forms;monodroid;monotouch;xamarin.android;xamarin.ios;xamarin.forms;xamarin.mac;xamarin.tvos;wpf;net;netstandard;net461;uwp;tizen;unoplatform;fody;
diff --git a/src/ReactiveUI.Fody/ReactiveUIPropertyWeaver.cs b/src/ReactiveUI.Fody/ReactiveUIPropertyWeaver.cs
index becb51d139..9b654cff7a 100644
--- a/src/ReactiveUI.Fody/ReactiveUIPropertyWeaver.cs
+++ b/src/ReactiveUI.Fody/ReactiveUIPropertyWeaver.cs
@@ -23,7 +23,7 @@ public class ReactiveUIPropertyWeaver
///
/// The module definition.
///
- public ModuleDefinition ModuleDefinition { get; set; }
+ public ModuleDefinition? ModuleDefinition { get; set; }
///
/// Gets or sets a action that will log an MessageImportance.High message to MSBuild. OPTIONAL.
@@ -31,7 +31,7 @@ public class ReactiveUIPropertyWeaver
///
/// The log information.
///
- public Action LogInfo { get; set; }
+ public Action? LogInfo { get; set; }
///
/// Gets or sets an action that will log an error message to MSBuild. OPTIONAL.
@@ -39,7 +39,7 @@ public class ReactiveUIPropertyWeaver
///
/// The log error.
///
- public Action LogError { get; set; }
+ public Action? LogError { get; set; }
///
/// Executes this property weaver.
@@ -55,22 +55,22 @@ public class ReactiveUIPropertyWeaver
///
public void Execute()
{
- var reactiveUI = ModuleDefinition.AssemblyReferences.Where(x => x.Name == "ReactiveUI").OrderByDescending(x => x.Version).FirstOrDefault();
+ var reactiveUI = ModuleDefinition?.AssemblyReferences.Where(x => x.Name == "ReactiveUI").OrderByDescending(x => x.Version).FirstOrDefault();
if (reactiveUI == null)
{
- LogInfo("Could not find assembly: ReactiveUI (" + string.Join(", ", ModuleDefinition.AssemblyReferences.Select(x => x.Name)) + ")");
+ LogInfo?.Invoke("Could not find assembly: ReactiveUI (" + string.Join(", ", ModuleDefinition?.AssemblyReferences.Select(x => x.Name)) + ")");
return;
}
- LogInfo($"{reactiveUI.Name} {reactiveUI.Version}");
- var helpers = ModuleDefinition.AssemblyReferences.Where(x => x.Name == "ReactiveUI.Fody.Helpers").OrderByDescending(x => x.Version).FirstOrDefault();
+ LogInfo?.Invoke($"{reactiveUI.Name} {reactiveUI.Version}");
+ var helpers = ModuleDefinition?.AssemblyReferences.Where(x => x.Name == "ReactiveUI.Fody.Helpers").OrderByDescending(x => x.Version).FirstOrDefault();
if (helpers == null)
{
- LogInfo("Could not find assembly: ReactiveUI.Fody.Helpers (" + string.Join(", ", ModuleDefinition.AssemblyReferences.Select(x => x.Name)) + ")");
+ LogInfo?.Invoke("Could not find assembly: ReactiveUI.Fody.Helpers (" + string.Join(", ", ModuleDefinition?.AssemblyReferences.Select(x => x.Name)) + ")");
return;
}
- LogInfo($"{helpers.Name} {helpers.Version}");
+ LogInfo?.Invoke($"{helpers.Name} {helpers.Version}");
var reactiveObject = new TypeReference("ReactiveUI", "IReactiveObject", ModuleDefinition, reactiveUI);
var targetTypes = ModuleDefinition.GetAllTypes().Where(x => x.BaseType != null && reactiveObject.IsAssignableFrom(x.BaseType)).ToArray();
var reactiveObjectExtensions = new TypeReference("ReactiveUI", "IReactiveObjectExtensions", ModuleDefinition, reactiveUI).Resolve();
@@ -79,92 +79,95 @@ public void Execute()
throw new Exception("reactiveObjectExtensions is null");
}
- var raiseAndSetIfChangedMethod = ModuleDefinition.ImportReference(reactiveObjectExtensions.Methods.Single(x => x.Name == "RaiseAndSetIfChanged"));
+ var raiseAndSetIfChangedMethod = ModuleDefinition?.ImportReference(reactiveObjectExtensions.Methods.Single(x => x.Name == "RaiseAndSetIfChanged"));
if (raiseAndSetIfChangedMethod == null)
{
throw new Exception("raiseAndSetIfChangedMethod is null");
}
- var reactiveAttribute = ModuleDefinition.FindType("ReactiveUI.Fody.Helpers", "ReactiveAttribute", helpers);
- if (reactiveAttribute == null)
+ if (ModuleDefinition != null)
{
- throw new Exception("reactiveAttribute is null");
- }
+ var reactiveAttribute = ModuleDefinition.FindType("ReactiveUI.Fody.Helpers", "ReactiveAttribute", helpers);
+ if (reactiveAttribute == null)
+ {
+ throw new Exception("reactiveAttribute is null");
+ }
- foreach (var targetType in targetTypes)
- {
- foreach (var property in targetType.Properties.Where(x => x.IsDefined(reactiveAttribute)).ToArray())
+ foreach (var targetType in targetTypes)
{
- if (property.SetMethod == null)
+ foreach (var property in targetType.Properties.Where(x => x.IsDefined(reactiveAttribute)).ToArray())
{
- LogError($"Property {property.DeclaringType.FullName}.{property.Name} has no setter, therefore it is not possible for the property to change, and thus should not be marked with [Reactive]");
- continue;
- }
+ if (property.SetMethod == null)
+ {
+ LogError?.Invoke($"Property {property.DeclaringType.FullName}.{property.Name} has no setter, therefore it is not possible for the property to change, and thus should not be marked with [Reactive]");
+ continue;
+ }
- // Declare a field to store the property value
- var field = new FieldDefinition("$" + property.Name, FieldAttributes.Private, property.PropertyType);
- targetType.Fields.Add(field);
+ // Declare a field to store the property value
+ var field = new FieldDefinition("$" + property.Name, FieldAttributes.Private, property.PropertyType);
+ targetType.Fields.Add(field);
- // Remove old field (the generated backing field for the auto property)
- var oldField = (FieldReference)property.GetMethod.Body.Instructions.Where(x => x.Operand is FieldReference).Single().Operand;
- var oldFieldDefinition = oldField.Resolve();
- targetType.Fields.Remove(oldFieldDefinition);
+ // Remove old field (the generated backing field for the auto property)
+ var oldField = (FieldReference)property.GetMethod.Body.Instructions.Where(x => x.Operand is FieldReference).Single().Operand;
+ var oldFieldDefinition = oldField.Resolve();
+ targetType.Fields.Remove(oldFieldDefinition);
- // See if there exists an initializer for the auto-property
- var constructors = targetType.Methods.Where(x => x.IsConstructor);
- foreach (var constructor in constructors)
- {
- var fieldAssignment = constructor.Body.Instructions.SingleOrDefault(x => Equals(x.Operand, oldFieldDefinition) || Equals(x.Operand, oldField));
- if (fieldAssignment != null)
+ // See if there exists an initializer for the auto-property
+ var constructors = targetType.Methods.Where(x => x.IsConstructor);
+ foreach (var constructor in constructors)
{
- // Replace field assignment with a property set (the stack semantics are the same for both,
- // so happily we don't have to manipulate the bytecode any further.)
- var setterCall = constructor.Body.GetILProcessor().Create(property.SetMethod.IsVirtual ? OpCodes.Callvirt : OpCodes.Call, property.SetMethod);
- constructor.Body.GetILProcessor().Replace(fieldAssignment, setterCall);
+ var fieldAssignment = constructor.Body.Instructions.SingleOrDefault(x => Equals(x.Operand, oldFieldDefinition) || Equals(x.Operand, oldField));
+ if (fieldAssignment != null)
+ {
+ // Replace field assignment with a property set (the stack semantics are the same for both,
+ // so happily we don't have to manipulate the bytecode any further.)
+ var setterCall = constructor.Body.GetILProcessor().Create(property.SetMethod.IsVirtual ? OpCodes.Callvirt : OpCodes.Call, property.SetMethod);
+ constructor.Body.GetILProcessor().Replace(fieldAssignment, setterCall);
+ }
}
- }
- // Build out the getter which simply returns the value of the generated field
- property.GetMethod.Body = new MethodBody(property.GetMethod);
- property.GetMethod.Body.Emit(il =>
- {
- il.Emit(OpCodes.Ldarg_0); // this
- il.Emit(OpCodes.Ldfld, field.BindDefinition(targetType)); // pop -> this.$PropertyName
- il.Emit(OpCodes.Ret); // Return the field value that is lying on the stack
- });
+ // Build out the getter which simply returns the value of the generated field
+ property.GetMethod.Body = new MethodBody(property.GetMethod);
+ property.GetMethod.Body.Emit(il =>
+ {
+ il.Emit(OpCodes.Ldarg_0); // this
+ il.Emit(OpCodes.Ldfld, field.BindDefinition(targetType)); // pop -> this.$PropertyName
+ il.Emit(OpCodes.Ret); // Return the field value that is lying on the stack
+ });
- TypeReference genericTargetType = targetType;
- if (targetType.HasGenericParameters)
- {
- var genericDeclaration = new GenericInstanceType(targetType);
- foreach (var parameter in targetType.GenericParameters)
+ TypeReference genericTargetType = targetType;
+ if (targetType.HasGenericParameters)
{
- genericDeclaration.GenericArguments.Add(parameter);
+ var genericDeclaration = new GenericInstanceType(targetType);
+ foreach (var parameter in targetType.GenericParameters)
+ {
+ genericDeclaration.GenericArguments.Add(parameter);
+ }
+
+ genericTargetType = genericDeclaration;
}
- genericTargetType = genericDeclaration;
- }
+ var methodReference = raiseAndSetIfChangedMethod.MakeGenericMethod(genericTargetType, property.PropertyType);
- var methodReference = raiseAndSetIfChangedMethod.MakeGenericMethod(genericTargetType, property.PropertyType);
+ // Build out the setter which fires the RaiseAndSetIfChanged method
+ if (property.SetMethod == null)
+ {
+ throw new Exception("[Reactive] is decorating " + property.DeclaringType.FullName + "." + property.Name + ", but the property has no setter so there would be nothing to react to. Consider removing the attribute.");
+ }
- // Build out the setter which fires the RaiseAndSetIfChanged method
- if (property.SetMethod == null)
- {
- throw new Exception("[Reactive] is decorating " + property.DeclaringType.FullName + "." + property.Name + ", but the property has no setter so there would be nothing to react to. Consider removing the attribute.");
+ property.SetMethod.Body = new MethodBody(property.SetMethod);
+ property.SetMethod.Body.Emit(il =>
+ {
+ il.Emit(OpCodes.Ldarg_0); // this
+ il.Emit(OpCodes.Ldarg_0); // this
+ il.Emit(OpCodes.Ldflda, field.BindDefinition(targetType)); // pop -> this.$PropertyName
+ il.Emit(OpCodes.Ldarg_1); // value
+ il.Emit(OpCodes.Ldstr, property.Name); // "PropertyName"
+ il.Emit(OpCodes.Call, methodReference); // pop * 4 -> this.RaiseAndSetIfChanged(this.$PropertyName, value, "PropertyName")
+ il.Emit(OpCodes.Pop); // We don't care about the result of RaiseAndSetIfChanged, so pop it off the stack (stack is now empty)
+ il.Emit(OpCodes.Ret); // Return out of the function
+ });
}
-
- property.SetMethod.Body = new MethodBody(property.SetMethod);
- property.SetMethod.Body.Emit(il =>
- {
- il.Emit(OpCodes.Ldarg_0); // this
- il.Emit(OpCodes.Ldarg_0); // this
- il.Emit(OpCodes.Ldflda, field.BindDefinition(targetType)); // pop -> this.$PropertyName
- il.Emit(OpCodes.Ldarg_1); // value
- il.Emit(OpCodes.Ldstr, property.Name); // "PropertyName"
- il.Emit(OpCodes.Call, methodReference); // pop * 4 -> this.RaiseAndSetIfChanged(this.$PropertyName, value, "PropertyName")
- il.Emit(OpCodes.Pop); // We don't care about the result of RaiseAndSetIfChanged, so pop it off the stack (stack is now empty)
- il.Emit(OpCodes.Ret); // Return out of the function
- });
}
}
}
diff --git a/src/ReactiveUI.LeakTests/ReactiveUI.LeakTests.csproj b/src/ReactiveUI.LeakTests/ReactiveUI.LeakTests.csproj
index 176cdf3c7e..9beaa6153c 100644
--- a/src/ReactiveUI.LeakTests/ReactiveUI.LeakTests.csproj
+++ b/src/ReactiveUI.LeakTests/ReactiveUI.LeakTests.csproj
@@ -1,6 +1,8 @@
- net461
+ netcoreapp3.1
+ $(TargetFrameworks);net461
+ enable
latest
diff --git a/src/ReactiveUI.Splat.Tests/ReactiveUI.Splat.Tests.csproj b/src/ReactiveUI.Splat.Tests/ReactiveUI.Splat.Tests.csproj
index 610fd870a1..e24830a8da 100644
--- a/src/ReactiveUI.Splat.Tests/ReactiveUI.Splat.Tests.csproj
+++ b/src/ReactiveUI.Splat.Tests/ReactiveUI.Splat.Tests.csproj
@@ -4,6 +4,7 @@
netcoreapp3.1
false
+ enable
latest
diff --git a/src/ReactiveUI.Testing.Tests/ReactiveUI.Testing.Tests.csproj b/src/ReactiveUI.Testing.Tests/ReactiveUI.Testing.Tests.csproj
index 3b85907d75..5c364ffd7a 100644
--- a/src/ReactiveUI.Testing.Tests/ReactiveUI.Testing.Tests.csproj
+++ b/src/ReactiveUI.Testing.Tests/ReactiveUI.Testing.Tests.csproj
@@ -4,6 +4,7 @@
$(TargetFrameworks);net472
netstandard2.0
$(TargetFramework)
+ enable
latest
diff --git a/src/ReactiveUI.Testing.Tests/TestFixture.cs b/src/ReactiveUI.Testing.Tests/TestFixture.cs
index 2e67133245..5bcd385813 100644
--- a/src/ReactiveUI.Testing.Tests/TestFixture.cs
+++ b/src/ReactiveUI.Testing.Tests/TestFixture.cs
@@ -21,17 +21,17 @@ public class TestFixture
///
/// Gets or sets the name.
///
- public string Name { get; set; }
+ public string? Name { get; set; }
///
/// Gets or sets the tests.
///
- public IEnumerable Tests { get; set; }
+ public IEnumerable? Tests { get; set; }
///
/// Gets or sets the variables.
///
[SuppressMessage("Design", "CA2227: Read only dictionary", Justification = "Used in mock.")]
- public Dictionary Variables { get; set; }
+ public Dictionary? Variables { get; set; }
}
}
diff --git a/src/ReactiveUI.Testing.Tests/TestFixtureBuilder.cs b/src/ReactiveUI.Testing.Tests/TestFixtureBuilder.cs
index b91e86bb6b..6d2fba1814 100644
--- a/src/ReactiveUI.Testing.Tests/TestFixtureBuilder.cs
+++ b/src/ReactiveUI.Testing.Tests/TestFixtureBuilder.cs
@@ -13,8 +13,8 @@ namespace ReactiveUI.Testing.Tests
public class TestFixtureBuilder : IBuilder
{
private int _count;
- private string _name;
- private List _tests = new List();
+ private string? _name;
+ private List? _tests = new List();
private Dictionary _variables = new Dictionary();
///
diff --git a/src/ReactiveUI.Testing.Tests/TestFixtureBuilderExtensionTests.cs b/src/ReactiveUI.Testing.Tests/TestFixtureBuilderExtensionTests.cs
index 68b061126e..0343c5e8d2 100644
--- a/src/ReactiveUI.Testing.Tests/TestFixtureBuilderExtensionTests.cs
+++ b/src/ReactiveUI.Testing.Tests/TestFixtureBuilderExtensionTests.cs
@@ -83,7 +83,7 @@ public void Should_Add_Key_Value(string key, string value)
TestFixture builder = new TestFixtureBuilder().WithKeyValue(key, value);
// Then
- builder.Variables[key].ShouldBe(value);
+ builder.Variables?[key].ShouldBe(value);
}
///
@@ -98,7 +98,7 @@ public void Should_Add_Key_Value_Pair(KeyValuePair keyValuePair)
TestFixture builder = new TestFixtureBuilder().WithKeyValue(keyValuePair);
// Then
- builder.Variables[keyValuePair.Key].ShouldBe(keyValuePair.Value);
+ builder.Variables?[keyValuePair.Key].ShouldBe(keyValuePair.Value);
}
///
diff --git a/src/ReactiveUI.Testing/IBuilderExtensions.cs b/src/ReactiveUI.Testing/IBuilderExtensions.cs
index 3e98c819aa..3bae638a57 100644
--- a/src/ReactiveUI.Testing/IBuilderExtensions.cs
+++ b/src/ReactiveUI.Testing/IBuilderExtensions.cs
@@ -46,9 +46,9 @@ public static TBuilder With(this TBuilder builder, ref TField
/// The values.
/// The builder.
public static TBuilder With(
- this TBuilder builder,
- ref List field,
- IEnumerable values)
+ this TBuilder builder,
+ ref List? field,
+ IEnumerable values)
where TBuilder : IBuilder
{
if (field == null)
@@ -77,7 +77,7 @@ public static TBuilder With(
/// The field.
/// The value.
/// The builder.
- public static TBuilder With(this TBuilder builder, ref List field, TField value)
+ public static TBuilder With(this TBuilder builder, ref List? field, TField value)
where TBuilder : IBuilder
{
if (field == null)
@@ -100,10 +100,11 @@ public static TBuilder With(this TBuilder builder, ref ListThe key value pair.
/// The builder.
public static TBuilder With(
- this TBuilder builder,
- ref Dictionary dictionary,
- KeyValuePair keyValuePair)
+ this TBuilder builder,
+ ref Dictionary dictionary,
+ KeyValuePair keyValuePair)
where TBuilder : IBuilder
+ where TKey : notnull
{
if (dictionary == null)
{
@@ -126,11 +127,12 @@ public static TBuilder With(
/// The value.
/// The builder.
public static TBuilder With(
- this TBuilder builder,
- ref Dictionary dictionary,
- TKey key,
- TField value)
+ this TBuilder builder,
+ ref Dictionary dictionary,
+ TKey key,
+ TField value)
where TBuilder : IBuilder
+ where TKey : notnull
{
if (dictionary == null)
{
@@ -152,9 +154,10 @@ public static TBuilder With(
/// The key value pair.
/// The builder.
public static TBuilder With(
- this TBuilder builder,
- ref Dictionary dictionary,
- IDictionary keyValuePair)
+ this TBuilder builder,
+ ref Dictionary dictionary,
+ IDictionary keyValuePair)
+ where TKey : notnull
{
if (dictionary == null)
{
diff --git a/src/ReactiveUI.Testing/ReactiveUI.Testing.csproj b/src/ReactiveUI.Testing/ReactiveUI.Testing.csproj
index 2625439f95..80eba9e858 100644
--- a/src/ReactiveUI.Testing/ReactiveUI.Testing.csproj
+++ b/src/ReactiveUI.Testing/ReactiveUI.Testing.csproj
@@ -6,6 +6,7 @@
ReactiveUI.Testing
Provides extensions for testing ReactiveUI based applications
ReactiveUI.Testing
+ enable
latest
mvvm;reactiveui;rx;reactive extensions;observable;LINQ;events;frp;test;
diff --git a/src/ReactiveUI.Tests/API/ApiApprovalTests.ReactiveUI.net472.approved.txt b/src/ReactiveUI.Tests/API/ApiApprovalTests.ReactiveUI.net472.approved.txt
index 08ac4f9a59..0bbd2e99d6 100644
--- a/src/ReactiveUI.Tests/API/ApiApprovalTests.ReactiveUI.net472.approved.txt
+++ b/src/ReactiveUI.Tests/API/ApiApprovalTests.ReactiveUI.net472.approved.txt
@@ -65,15 +65,15 @@ namespace ReactiveUI
}
public static class CommandBinder
{
- public static ReactiveUI.IReactiveBinding BindCommand(this TView view, TViewModel viewModel, System.Linq.Expressions.Expression> propertyName, System.Linq.Expressions.Expression> controlName, string toEvent = null)
+ public static ReactiveUI.IReactiveBinding BindCommand(this TView view, TViewModel viewModel, System.Linq.Expressions.Expression> propertyName, System.Linq.Expressions.Expression> controlName, string? toEvent = null)
where TView : class, ReactiveUI.IViewFor
where TViewModel : class
where TProp : System.Windows.Input.ICommand { }
- public static ReactiveUI.IReactiveBinding BindCommand(this TView view, TViewModel viewModel, System.Linq.Expressions.Expression> propertyName, System.Linq.Expressions.Expression> controlName, System.IObservable withParameter, string toEvent = null)
+ public static ReactiveUI.IReactiveBinding BindCommand(this TView view, TViewModel viewModel, System.Linq.Expressions.Expression> propertyName, System.Linq.Expressions.Expression> controlName, System.IObservable withParameter, string? toEvent = null)
where TView : class, ReactiveUI.IViewFor
where TViewModel : class
where TProp : System.Windows.Input.ICommand { }
- public static ReactiveUI.IReactiveBinding BindCommand(this TView view, TViewModel viewModel, System.Linq.Expressions.Expression> propertyName, System.Linq.Expressions.Expression> controlName, System.Linq.Expressions.Expression> withParameter, string toEvent = null)
+ public static ReactiveUI.IReactiveBinding BindCommand(this TView view, TViewModel viewModel, System.Linq.Expressions.Expression> propertyName, System.Linq.Expressions.Expression> controlName, System.Linq.Expressions.Expression> withParameter, string? toEvent = null)
where TView : class, ReactiveUI.IViewFor
where TViewModel : class
where TProp : System.Windows.Input.ICommand { }
@@ -81,47 +81,46 @@ namespace ReactiveUI
public class CommandBinderImplementation : Splat.IEnableLogger
{
public CommandBinderImplementation() { }
- public ReactiveUI.IReactiveBinding BindCommand(TViewModel viewModel, TView view, System.Linq.Expressions.Expression> vmProperty, System.Linq.Expressions.Expression> controlProperty, System.Func withParameter, string toEvent = null)
+ public ReactiveUI.IReactiveBinding BindCommand(TViewModel viewModel, TView view, System.Linq.Expressions.Expression> vmProperty, System.Linq.Expressions.Expression> controlProperty, System.Func withParameter, string? toEvent = null)
where TView : class, ReactiveUI.IViewFor
where TViewModel : class
where TProp : System.Windows.Input.ICommand { }
- public ReactiveUI.IReactiveBinding BindCommand(TViewModel viewModel, TView view, System.Linq.Expressions.Expression> vmProperty, System.Linq.Expressions.Expression> controlProperty, System.IObservable withParameter, string toEvent = null)
+ public ReactiveUI.IReactiveBinding BindCommand(TViewModel viewModel, TView view, System.Linq.Expressions.Expression> vmProperty, System.Linq.Expressions.Expression> controlProperty, System.IObservable withParameter, string? toEvent = null)
where TView : class, ReactiveUI.IViewFor
where TViewModel : class
where TProp : System.Windows.Input.ICommand { }
}
public static class ComparerChainingExtensions
{
- public static System.Collections.Generic.IComparer ThenBy(this System.Collections.Generic.IComparer parent, System.Func selector) { }
- public static System.Collections.Generic.IComparer ThenBy(this System.Collections.Generic.IComparer parent, System.Func selector, System.Collections.Generic.IComparer comparer) { }
- public static System.Collections.Generic.IComparer ThenByDescending(this System.Collections.Generic.IComparer parent, System.Func selector) { }
- public static System.Collections.Generic.IComparer ThenByDescending(this System.Collections.Generic.IComparer parent, System.Func selector, System.Collections.Generic.IComparer comparer) { }
+ public static System.Collections.Generic.IComparer ThenBy(this System.Collections.Generic.IComparer? parent, System.Func selector) { }
+ public static System.Collections.Generic.IComparer ThenBy(this System.Collections.Generic.IComparer? parent, System.Func selector, System.Collections.Generic.IComparer comparer) { }
+ public static System.Collections.Generic.IComparer ThenByDescending(this System.Collections.Generic.IComparer? parent, System.Func selector) { }
+ public static System.Collections.Generic.IComparer ThenByDescending(this System.Collections.Generic.IComparer? parent, System.Func selector, System.Collections.Generic.IComparer comparer) { }
}
public class ComponentModelTypeConverter : ReactiveUI.IBindingTypeConverter, Splat.IEnableLogger
{
public ComponentModelTypeConverter() { }
public int GetAffinityForObjects(System.Type fromType, System.Type toType) { }
- public bool TryConvert(object from, System.Type toType, object conversionHint, out object result) { }
+ public bool TryConvert(object? from, System.Type toType, object? conversionHint, out object? result) { }
}
public class CreatesCommandBindingViaCommandParameter : ReactiveUI.ICreatesCommandBinding
{
public CreatesCommandBindingViaCommandParameter() { }
- public System.IDisposable BindCommandToObject(System.Windows.Input.ICommand command, object target, System.IObservable