Skip to content

Commit

Permalink
Update solution to use net 8.0 (#1063)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPulman authored Nov 14, 2023
1 parent 4d7b838 commit 42980da
Show file tree
Hide file tree
Showing 83 changed files with 505 additions and 219 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Splat currently supports:

[Always Be NuGetting](https://nuget.org/packages/Splat/). Package contains binaries for:

* .NET Framework 4.6.2, .NET Framework 4.7.2, .NET Standard 2.0 and .NET 6.0
* .NET Framework 4.6.2, .NET Framework 4.7.2, .NET Standard 2.0, .NET 6.0, .NET 7.0, and .NET 8.0
* WPF
* Windows Forms
* UWP
Expand Down
8 changes: 4 additions & 4 deletions src/Directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
<ImplicitUsings>true</ImplicitUsings>
<LangVersion>preview</LangVersion>
<NoWarn>$(NoWarn);VSSpell001</NoWarn>
<NoWarn>$(NoWarn);VSSpell001;SA1010</NoWarn>

<!-- disable sourcelink on mono, to workaround https://github.com/dotnet/sourcelink/issues/155 -->
<EnableSourceLink Condition=" '$(OS)' != 'Windows_NT' AND '$(MSBuildRuntimeType)' != 'Core' ">false</EnableSourceLink>
Expand All @@ -52,13 +52,13 @@
</PropertyGroup>

<ItemGroup Condition="$(IsTestProject) or $(MSBuildProjectName.Contains('TestRunner'))">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="Xunit.StaFact" Version="1.1.11" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.Reactive.Testing" Version="6.0.0" />
<PackageReference Include="PublicApiGenerator" Version="11.0.0" />
<PackageReference Include="Verify.Xunit" Version="22.1.4" />
<PackageReference Include="Verify.Xunit" Version="22.2.0" />
</ItemGroup>

<ItemGroup Condition="$(IsTestProject)">
Expand All @@ -82,7 +82,7 @@
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.133" PrivateAssets="all" />
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.507" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers" Version="4.6.1" PrivateAssets="All" />
<PackageReference Include="Roslynator.Analyzers" Version="4.6.2" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions src/Directory.build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
<PropertyGroup Condition="$(TargetFramework.StartsWith('Xamarin.iOS'))">
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA;IOS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0-ios')) or $(TargetFramework.StartsWith('net7.0-ios'))">
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0-ios')) or $(TargetFramework.StartsWith('net7.0-ios')) or $(TargetFramework.StartsWith('net8.0-ios'))">
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA;IOS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('Xamarin.Mac'))">
<DefineConstants>$(DefineConstants);MONO;COCOA</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0-macos')) or $(TargetFramework.StartsWith('net7.0-macos'))">
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0-macos')) or $(TargetFramework.StartsWith('net7.0-macos')) or $(TargetFramework.StartsWith('net8.0-macos'))">
<DefineConstants>$(DefineConstants);MONO;COCOA</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('Xamarin.TVOS'))">
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA;TVOS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0-tvos')) or $(TargetFramework.StartsWith('net7.0-tvos'))">
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0-tvos')) or $(TargetFramework.StartsWith('net7.0-tvos')) or $(TargetFramework.StartsWith('net8.0-tvos'))">
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA;TVOS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0-maccatalyst')) or $(TargetFramework.StartsWith('net7.0-maccatalyst'))">
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0-maccatalyst')) or $(TargetFramework.StartsWith('net7.0-maccatalyst')) or $(TargetFramework.StartsWith('net8.0-maccatalyst'))">
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA;MACCATALYST</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('Xamarin.WatchOS'))">
Expand All @@ -34,13 +34,13 @@
<PropertyGroup Condition="$(TargetFramework.StartsWith('MonoAndroid'))">
<DefineConstants>$(DefineConstants);MONO;ANDROID</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0-android')) or $(TargetFramework.StartsWith('net7.0-android'))">
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0-android')) or $(TargetFramework.StartsWith('net7.0-android')) or $(TargetFramework.StartsWith('net8.0-android'))">
<DefineConstants>$(DefineConstants);MONO;ANDROID</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('tizen'))">
<DefineConstants>$(DefineConstants);TIZEN</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.Equals('net6.0')) or $(TargetFramework.Equals('net7.0')) or $(TargetFramework.Equals('netstandard2.1')) or $(TargetFramework.Equals('netstandard2.0'))">
<PropertyGroup Condition="$(TargetFramework.Equals('net6.0')) or $(TargetFramework.Equals('net7.0')) or $(TargetFramework.Equals('net8.0')) or $(TargetFramework.Equals('netstandard2.1')) or $(TargetFramework.Equals('netstandard2.0'))">
<DefineConstants>$(DefineConstants);IS_SHARED_NET</DefineConstants>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void OnException(Exception exception)
Microsoft.AppCenter.Crashes.Crashes.TrackError(exception, properties);
}

private IDictionary<string, string> GetProperties()
private Dictionary<string, string> GetProperties()
{
var properties = new Dictionary<string, string>
{
Expand Down
15 changes: 4 additions & 11 deletions src/Splat.AppCenter/AppCenterViewTracking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,9 @@ public sealed class AppCenterViewTracking : IViewTracking
/// Track a view navigation using just a name.
/// </summary>
/// <param name="name">Name of the view.</param>
public void OnViewNavigation(string name)
{
var properties = GetProperties(name);
public void OnViewNavigation(string name) =>
Microsoft.AppCenter.Analytics.Analytics.TrackEvent("PageView", GetProperties(name));

Microsoft.AppCenter.Analytics.Analytics.TrackEvent("PageView", properties);
}

private static IDictionary<string, string> GetProperties(string name) =>
new Dictionary<string, string>
{
{ "Name", name },
};
private static Dictionary<string, string> GetProperties(string name) =>
new() { { "Name", name }, };
}
2 changes: 1 addition & 1 deletion src/Splat.AppCenter/Splat.AppCenter.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0-windows10.0.17763.0;net7.0-windows10.0.17763.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0-windows10.0.17763.0;net7.0-windows10.0.17763.0;net8.0-windows10.0.17763.0</TargetFrameworks>
<!--need to consider? monoandroid50;xamarin.ios10,uap10.0 -->
<AssemblyName>Splat.AppCenter</AssemblyName>
<RootNamespace>Splat</RootNamespace>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">$(TargetFrameworks);net462</TargetFrameworks>
<AssemblyName>Splat.ApplicationInsights</AssemblyName>
<RootNamespace>Splat</RootNamespace>
Expand Down
2 changes: 1 addition & 1 deletion src/Splat.Autofac.Tests/Splat.Autofac.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net6.0-windows10.0.17763.0</TargetFrameworks>

<IsPackable>false</IsPackable>
<NoWarn>$(NoWarn);1591;CA1707;SA1633;CA2000</NoWarn>
<NoWarn>$(NoWarn);1591;CA1707;SA1633;CA2000;CA1851</NoWarn>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Splat.Autofac/Splat.Autofac.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">$(TargetFrameworks);net462</TargetFrameworks>
<Description>Autofac adapter for Splat</Description>
<Nullable>enable</Nullable>
Expand Down
11 changes: 10 additions & 1 deletion src/Splat.Avalonia.Autofac/AvaloniaMixins.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ public static AppBuilder UseReactiveUIWithAutofac(this AppBuilder builder, Actio
{
return;
}

#if NETSTANDARD
if (containerConfig is null)
{
throw new ArgumentNullException(nameof(containerConfig));
}
#else
ArgumentNullException.ThrowIfNull(containerConfig);
#endif

var builder = new ContainerBuilder();
var autofacResolver = new AutofacDependencyResolver(builder);
Expand Down Expand Up @@ -85,6 +88,7 @@ public static AppBuilder UseReactiveUIWithDIContainer<TContainer>(
return;
}

#if NETSTANDARD
if (containerFactory is null)
{
throw new ArgumentNullException(nameof(containerFactory));
Expand All @@ -99,6 +103,11 @@ public static AppBuilder UseReactiveUIWithDIContainer<TContainer>(
{
throw new ArgumentNullException(nameof(dependencyResolverFactory));
}
#else
ArgumentNullException.ThrowIfNull(containerFactory);
ArgumentNullException.ThrowIfNull(containerConfig);
ArgumentNullException.ThrowIfNull(dependencyResolverFactory);
#endif

var container = containerFactory();
Locator.CurrentMutable.RegisterConstant(container, typeof(TContainer));
Expand Down
2 changes: 1 addition & 1 deletion src/Splat.Avalonia.Autofac/Splat.Avalonia.Autofac.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
10 changes: 10 additions & 0 deletions src/Splat.Avalonia.DryIoc/AvaloniaMixins.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ public static AppBuilder UseReactiveUIWithDryIoc(this AppBuilder builder, Action
return;
}

#if NETSTANDARD
if (containerConfig is null)
{
throw new ArgumentNullException(nameof(containerConfig));
}
#else
ArgumentNullException.ThrowIfNull(containerConfig);
#endif

var container = new Container();
Locator.CurrentMutable.RegisterConstant(container, typeof(Container));
Expand Down Expand Up @@ -72,6 +76,7 @@ public static AppBuilder UseReactiveUIWithDIContainer<TContainer>(
return;
}

#if NETSTANDARD
if (containerFactory is null)
{
throw new ArgumentNullException(nameof(containerFactory));
Expand All @@ -86,6 +91,11 @@ public static AppBuilder UseReactiveUIWithDIContainer<TContainer>(
{
throw new ArgumentNullException(nameof(dependencyResolverFactory));
}
#else
ArgumentNullException.ThrowIfNull(containerFactory);
ArgumentNullException.ThrowIfNull(containerConfig);
ArgumentNullException.ThrowIfNull(dependencyResolverFactory);
#endif

var container = containerFactory();
Locator.CurrentMutable.RegisterConstant(container, typeof(TContainer));
Expand Down
2 changes: 1 addition & 1 deletion src/Splat.Avalonia.DryIoc/Splat.Avalonia.DryIoc.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ public static AppBuilder UseReactiveUIWithMicrosoftDependencyResolver(this AppBu
return;
}

#if NETSTANDARD
if (containerConfig is null)
{
throw new ArgumentNullException(nameof(containerConfig));
}
#else
ArgumentNullException.ThrowIfNull(containerConfig);
#endif

IServiceCollection serviceCollection = new ServiceCollection();
Locator.CurrentMutable.RegisterConstant(serviceCollection, typeof(IServiceCollection));
Expand Down Expand Up @@ -88,6 +92,7 @@ public static AppBuilder UseReactiveUIWithDIContainer<TContainer>(
return;
}

#if NETSTANDARD
if (containerFactory is null)
{
throw new ArgumentNullException(nameof(containerFactory));
Expand All @@ -102,6 +107,11 @@ public static AppBuilder UseReactiveUIWithDIContainer<TContainer>(
{
throw new ArgumentNullException(nameof(dependencyResolverFactory));
}
#else
ArgumentNullException.ThrowIfNull(containerFactory);
ArgumentNullException.ThrowIfNull(containerConfig);
ArgumentNullException.ThrowIfNull(dependencyResolverFactory);
#endif

var container = containerFactory();
Locator.CurrentMutable.RegisterConstant(container, typeof(TContainer));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand All @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.5" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0-rc.2.23479.6" />
<ProjectReference Include="..\Splat\Splat.csproj" />
</ItemGroup>

Expand Down
10 changes: 10 additions & 0 deletions src/Splat.Avalonia.Ninject/AvaloniaMixins.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ public static AppBuilder UseReactiveUIWithNinject(this AppBuilder builder, Actio
return;
}

#if NETSTANDARD
if (containerConfig is null)
{
throw new ArgumentNullException(nameof(containerConfig));
}
#else
ArgumentNullException.ThrowIfNull(containerConfig);
#endif

var container = new StandardKernel();
Locator.CurrentMutable.RegisterConstant(container, typeof(StandardKernel));
Expand Down Expand Up @@ -72,6 +76,7 @@ public static AppBuilder UseReactiveUIWithDIContainer<TContainer>(
return;
}

#if NETSTANDARD
if (containerFactory is null)
{
throw new ArgumentNullException(nameof(containerFactory));
Expand All @@ -86,6 +91,11 @@ public static AppBuilder UseReactiveUIWithDIContainer<TContainer>(
{
throw new ArgumentNullException(nameof(dependencyResolverFactory));
}
#else
ArgumentNullException.ThrowIfNull(containerFactory);
ArgumentNullException.ThrowIfNull(containerConfig);
ArgumentNullException.ThrowIfNull(dependencyResolverFactory);
#endif

var container = containerFactory();
Locator.CurrentMutable.RegisterConstant(container, typeof(TContainer));
Expand Down
2 changes: 1 addition & 1 deletion src/Splat.Avalonia.Ninject/Splat.Avalonia.Ninject.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Splat.Avalonia.Tests/Mocks/ViewModels/BarViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace ReactiveUIDemo.ViewModels
{
internal class BarViewModel(IScreen screen) : ReactiveObject, IRoutableViewModel
internal sealed class BarViewModel(IScreen screen) : ReactiveObject, IRoutableViewModel
{
public string UrlPathSegment => "Bar";

Expand Down
2 changes: 1 addition & 1 deletion src/Splat.Avalonia.Tests/Mocks/ViewModels/FooViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace ReactiveUIDemo.ViewModels
{
internal class FooViewModel(IScreen screen) : ReactiveObject, IRoutableViewModel
internal sealed class FooViewModel(IScreen screen) : ReactiveObject, IRoutableViewModel
{
public string UrlPathSegment => "Foo";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace ReactiveUIDemo.ViewModels
{
internal class MainWindowViewModel : ReactiveObject
internal sealed class MainWindowViewModel : ReactiveObject
{
public RoutedViewHostPageViewModel RoutedViewHost { get; } = new();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace ReactiveUIDemo.ViewModels
{
internal class RoutedViewHostPageViewModel : ReactiveObject, IScreen
internal sealed class RoutedViewHostPageViewModel : ReactiveObject, IScreen
{
public RoutedViewHostPageViewModel()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Splat.Avalonia.Tests/Mocks/Views/BarView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace ReactiveUIDemo.Views
{
internal partial class BarView : UserControl, IViewFor<BarViewModel>
internal sealed partial class BarView : UserControl, IViewFor<BarViewModel>
{
public BarView() => InitializeComponent();

Expand Down
2 changes: 1 addition & 1 deletion src/Splat.Avalonia.Tests/Mocks/Views/FooView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace ReactiveUIDemo.Views
{
internal partial class FooView : UserControl, IViewFor<FooViewModel>
internal sealed partial class FooView : UserControl, IViewFor<FooViewModel>
{
public FooView() => InitializeComponent();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ namespace Splat
{
public BitmapLoaderException() { }
public BitmapLoaderException(string message) { }
protected BitmapLoaderException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public BitmapLoaderException(string message, System.Exception innerException) { }
}
public static class BitmapMixins
Expand Down
Loading

0 comments on commit 42980da

Please sign in to comment.