Skip to content

Commit

Permalink
housekeeping: Update version and fix nullability issues (#2738)
Browse files Browse the repository at this point in the history
* housekeeping: Change the non-package repos

* housekeeping: Update versions and fix nullability issues
  • Loading branch information
glennawatson authored Apr 8, 2021
1 parent b5b54aa commit fea6393
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/Directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.4.190" PrivateAssets="all" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.4.194" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.321" PrivateAssets="all" />
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.333" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers" Version="3.1.0" PrivateAssets="All" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/ReactiveUI.Blazor/ReactiveUI.Blazor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net5')) ">
<PackageReference Include="Microsoft.AspNetCore.Components" Version="5.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Components" Version="5.0.5" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/ReactiveUI.Drawing/ReactiveUI.Drawing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Splat.Drawing" Version="10.*" />
<PackageReference Include="Splat.Drawing" Version="11.*" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/ReactiveUI.Fody.Helpers/ReactiveUI.Fody.Helpers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<ItemGroup>
<PackageReference Include="Fody" Version="6.5.1" PrivateAssets="None" />
<PackageReference Include="FodyPackaging" Version="6.5.0" PrivateAssets="All" />
<PackageReference Include="FodyPackaging" Version="6.5.1" PrivateAssets="All" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
</ItemGroup>

Expand Down
8 changes: 4 additions & 4 deletions src/ReactiveUI.Splat.Tests/ReactiveUI.Splat.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Splat.Autofac" Version="10.*" />
<PackageReference Include="Splat.DryIoc" Version="10.*" />
<PackageReference Include="Splat.Ninject" Version="10.*" />
<PackageReference Include="Splat.Autofac" Version="11.*" />
<PackageReference Include="Splat.DryIoc" Version="11.*" />
<PackageReference Include="Splat.Ninject" Version="11.*" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ReactiveUI\ReactiveUI.csproj" />
</ItemGroup>

</Project>
</Project>
4 changes: 3 additions & 1 deletion src/ReactiveUI.XamForms.Tests/Mocks/ChildViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System;

using Splat;

namespace ReactiveUI.XamForms.Tests.Mocks
Expand All @@ -15,7 +17,7 @@ public class ChildViewModel : ReactiveObject, IRoutableViewModel
/// <summary>
/// Initializes a new instance of the <see cref="ChildViewModel"/> class.
/// </summary>
public ChildViewModel() => HostScreen = Locator.Current.GetService<IScreen>();
public ChildViewModel() => HostScreen = Locator.Current.GetService<IScreen>() ?? throw new InvalidOperationException("There is no valid screens");

/// <summary>
/// Initializes a new instance of the <see cref="ChildViewModel"/> class.
Expand Down
4 changes: 3 additions & 1 deletion src/ReactiveUI.XamForms.Tests/Mocks/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System;

using Splat;

namespace ReactiveUI.XamForms.Tests.Mocks
Expand All @@ -15,7 +17,7 @@ public class MainViewModel : ReactiveObject, IRoutableViewModel
/// <summary>
/// Initializes a new instance of the <see cref="MainViewModel"/> class.
/// </summary>
public MainViewModel() => HostScreen = Locator.Current.GetService<IScreen>();
public MainViewModel() => HostScreen = Locator.Current.GetService<IScreen>() ?? throw new InvalidOperationException("There is no valid screen");

/// <inheritdoc/>
public string? UrlPathSegment => "Main view";
Expand Down
8 changes: 8 additions & 0 deletions src/ReactiveUI.XamForms.Tests/Mocks/NavigationViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

using System;
using System.Reactive;
using System.Reactive.Linq;

using Splat;

namespace ReactiveUI.XamForms.Tests.Mocks
Expand All @@ -25,6 +27,12 @@ public class NavigationViewModel : ReactiveObject, IScreen
public IObservable<IRoutableViewModel> Navigate(string name)
{
var viewModel = Locator.Current.GetService<IRoutableViewModel>(name);

if (viewModel is null)
{
return Observable.Throw<IRoutableViewModel>(new InvalidOperationException("Could not find the view model with the name."));
}

return Router.Navigate.Execute(viewModel);
}

Expand Down
6 changes: 6 additions & 0 deletions src/ReactiveUI.XamForms.Tests/RoutedViewHostTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,12 @@ private RoutedViewHost CreateRoutedViewHost(string? initialViewModel = nameof(Ma
if (initialViewModel is not null)
{
var mainViewModel = Locator.Current.GetService<IRoutableViewModel>(initialViewModel);

if (mainViewModel is null)
{
throw new InvalidOperationException("There should be a valid view model.");
}

_navigationViewModel.Router.NavigationStack.Add(mainViewModel);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ public sealed class ObservableAsPropertyHelper<T> : IHandleObservableErrors, IDi
public ObservableAsPropertyHelper(
IObservable<T> observable,
Action<T> onChanged,
#pragma warning disable CS8601 // Possible null reference assignment.
T initialValue = default,
#pragma warning restore CS8601 // Possible null reference assignment.
bool deferSubscription = false,
IScheduler? scheduler = null)
: this(observable, onChanged, null, initialValue, deferSubscription, scheduler)
Expand Down Expand Up @@ -96,7 +98,9 @@ public ObservableAsPropertyHelper(
IObservable<T> observable,
Action<T> onChanged,
Action<T>? onChanging = null,
#pragma warning disable CS8601 // Possible null reference assignment.
T initialValue = default,
#pragma warning restore CS8601 // Possible null reference assignment.
bool deferSubscription = false,
IScheduler? scheduler = null)
: this(observable, onChanged, onChanging, () => initialValue, deferSubscription, scheduler)
Expand Down Expand Up @@ -235,7 +239,9 @@ public T Value
/// normally be a Dispatcher-based scheduler.
/// </param>
/// <returns>A default property helper.</returns>
#pragma warning disable CS8601 // Possible null reference assignment.
public static ObservableAsPropertyHelper<T> Default(T initialValue = default, IScheduler? scheduler = null) =>
#pragma warning restore CS8601 // Possible null reference assignment.
new ObservableAsPropertyHelper<T>(Observable<T>.Never, _ => { }, initialValue!, false, scheduler);

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/ReactiveUI/ReactiveUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<ItemGroup>
<Compile Remove="Platforms\**\*.cs" />
<None Include="Platforms\**\*.cs" />
<PackageReference Include="Splat" Version="10.*" />
<PackageReference Include="Splat" Version="11.*" />
<PackageReference Include="DynamicData" Version="7.*" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
</ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions src/ReactiveUI/Suspension/SuspensionHostExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ public static IDisposable SetupDefaultSuspendResume(this ISuspensionHost item, I
var ret = new CompositeDisposable();
driver ??= Locator.Current.GetService<ISuspensionDriver>();

if (driver is null)
{
item.Log().Error("Could not find a valid driver and therefore cannot setup Suspend/Resume.");
return Disposable.Empty;
}

ret.Add(item.ShouldInvalidateState
.SelectMany(_ => driver.InvalidateState())
.LoggedCatch(item, Observables.Unit, "Tried to invalidate app state")
Expand Down

0 comments on commit fea6393

Please sign in to comment.