Skip to content

Commit

Permalink
Housekeeping Update to Net 9.0 (#1232)
Browse files Browse the repository at this point in the history
* Update to Net 9.0

* Add Net 9 to targets

* Refactor and update code

Ensure that all projects have net9.0

* Update Splat.sln
  • Loading branch information
ChrisPulman authored Nov 14, 2024
1 parent ff47304 commit 154ef0f
Show file tree
Hide file tree
Showing 55 changed files with 1,358 additions and 124 deletions.
16 changes: 9 additions & 7 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
<PackageVersion Include="Microsoft.AppCenter.Analytics" Version="5.0.6" />
<PackageVersion Include="Microsoft.AppCenter.Crashes" Version="5.0.6" />
<PackageVersion Include="Microsoft.ApplicationInsights" Version="2.22.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Mindscape.Raygun4Net.NetCore" Version="11.1.1" />
<PackageVersion Include="Mindscape.Raygun4Net.NetCore" Version="11.1.2" />
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.146" />
<PackageVersion Include="Ninject" Version="3.3.6" />
<PackageVersion Include="NLog" Version="5.3.4" />
Expand All @@ -33,7 +33,7 @@
<PackageVersion Include="SimpleInjector" Version="5.5.0" />
<PackageVersion Include="stylecop.analyzers" Version="1.2.0-beta.556" />
<PackageVersion Include="System.AppContext" Version="4.3.0" />
<PackageVersion Include="System.Collections.Immutable" Version="8.0.0" />
<PackageVersion Include="System.Collections.Immutable" Version="9.0.0" />
<PackageVersion Include="System.Collections.NonGeneric" Version="4.3.0" />
<PackageVersion Include="System.Console" Version="4.3.1" />
<PackageVersion Include="System.Diagnostics.Debug" Version="4.3.0" />
Expand All @@ -43,6 +43,7 @@
<PackageVersion Include="System.IO.FileSystem" Version="4.3.0" />
<PackageVersion Include="System.IO.FileSystem.Watcher" Version="4.3.0" />
<PackageVersion Include="System.Linq" Version="4.3.0" />
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Net.NameResolution" Version="4.3.0" />
<PackageVersion Include="System.Net.Requests" Version="4.3.0" />
<PackageVersion Include="System.Net.Sockets" Version="4.3.0" />
Expand All @@ -53,6 +54,7 @@
<PackageVersion Include="System.Runtime.InteropServices" Version="4.3.0" />
<PackageVersion Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<PackageVersion Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
<PackageVersion Include="System.Text.Json" Version="9.0.0" />
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageVersion Include="System.Threading" Version="4.3.0" />
<PackageVersion Include="System.Threading.Thread" Version="4.3.0" />
Expand All @@ -62,9 +64,9 @@
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.console" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="Verify.Xunit" Version="28.1.2" />
<PackageVersion Include="Verify.Xunit" Version="28.2.0" />
<PackageVersion Include="Xunit.StaFact" Version="1.1.11" />
<PackageVersion Include="FluentAssertions" Version="6.12.1" />
<PackageVersion Include="FluentAssertions" Version="6.12.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="Microsoft.Reactive.Testing" Version="6.0.1" />
<PackageVersion Include="PublicApiGenerator" Version="11.1.0" />
Expand All @@ -80,4 +82,4 @@
<PackageVersion Include="System.Drawing.Primitives" Version="4.3.0" />
<PackageVersion Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
</ItemGroup>
</Project>
</Project>
8 changes: 4 additions & 4 deletions src/Directory.build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591;1701;1702;1705;VSX1000</NoWarn>
<NoWarn>$(NoWarn);1591;1701;1702;1705;VSX1000;IDE0130</NoWarn>
<Platform>AnyCPU</Platform>
<IsTestProject>$(MSBuildProjectName.Contains('Tests'))</IsTestProject>
<DebugType>embedded</DebugType>
Expand All @@ -14,7 +14,7 @@
<PackageDescription>A library to make things cross-platform that should be.</PackageDescription>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<Owners>anaisbetts;ghuntley</Owners>
<PackageTags>drawing;colours;geometry;logging;unit test detection;service location;image handling;portable;xamarin;xamarin ios;xamarin mac;android;monodroid;uwp;net45</PackageTags>
<PackageTags>drawing;colours;geometry;logging;unit test detection;service location;image handling;portable;xamarin;xamarin ios;xamarin mac;android</PackageTags>
<PackageReleaseNotes>https://github.com/reactiveui/splat/releases</PackageReleaseNotes>
<RepositoryUrl>https://github.com/reactiveui/splat</RepositoryUrl>
<RepositoryType>git</RepositoryType>
Expand All @@ -37,8 +37,8 @@
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- Include PDB in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<SplatTargetFrameworks>netstandard2.0;net6.0;net8.0</SplatTargetFrameworks>
<SplatWindowsTargetFrameworks>net6.0-windows10.0.17763.0;net8.0-windows10.0.17763.0</SplatWindowsTargetFrameworks>
<SplatTargetFrameworks>netstandard2.0;net8.0;net9.0</SplatTargetFrameworks>
<SplatWindowsTargetFrameworks>net8.0-windows10.0.17763.0;net9.0-windows10.0.17763.0</SplatWindowsTargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="$(IsTestProject) != 'true'">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<PropertyGroup Condition="$(TargetFramework.EndsWith('0-android'))">
<DefineConstants>$(DefineConstants);MONO;ANDROID</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.Equals('net6.0')) or $(TargetFramework.Equals('net8.0')) or $(TargetFramework.Equals('netstandard2.1')) or $(TargetFramework.Equals('netstandard2.0'))">
<PropertyGroup Condition="$(TargetFramework.Equals('net8.0')) or $(TargetFramework.Equals('net9.0')) or $(TargetFramework.Equals('netstandard2.1')) or $(TargetFramework.Equals('netstandard2.0'))">
<DefineConstants>$(DefineConstants);IS_SHARED_NET</DefineConstants>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions src/ReactiveUI.DI.Tests/ReactiveUI.DI.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net472;net8.0;</TargetFrameworks>
<TargetFrameworks>net472;net8.0;net9.0</TargetFrameworks>
<NoWarn>$(NoWarn);1591;CA1707;SA1633;CA2000</NoWarn>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
Expand All @@ -14,7 +14,7 @@
<ProjectReference Include="..\Splat.Autofac\Splat.Autofac.csproj" />
</ItemGroup>
</When>
<When Condition="$(TargetFramework.StartsWith('net8.0'))">
<When Condition="$(TargetFramework.StartsWith('net8.0')) or $(TargetFramework.StartsWith('net9.0'))">
<ItemGroup>
<Compile Remove="AutoFacReactiveUIDependencyTests.cs" />
<Compile Remove="NinjectReactiveUIDependencyTests.cs" />
Expand Down
6 changes: 5 additions & 1 deletion src/Splat.Autofac.Tests/Splat.Autofac.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0-windows10.0.17763.0</TargetFrameworks>
<TargetFrameworks>net8.0-windows10.0.17763.0;net9.0-windows10.0.17763.0</TargetFrameworks>

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

<ItemGroup>
<PackageReference Include="System.Net.Http" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Splat.Autofac\Splat.Autofac.csproj" />
<ProjectReference Include="..\Splat.Common.Test\Splat.Common.Test.csproj" />
Expand Down
11 changes: 3 additions & 8 deletions src/Splat.Autofac/AutofacDependencyResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,9 @@ protected virtual void Dispose(bool disposing)

var lifeTimeScope = _lifetimeScope ?? _internalLifetimeScope;

if (contract is null || string.IsNullOrWhiteSpace(contract))
{
lifeTimeScope.TryResolve(serviceType, out serviceInstance!);
}
else
{
lifeTimeScope.TryResolveNamed(contract, serviceType, out serviceInstance!);
}
_ = contract is null || string.IsNullOrWhiteSpace(contract)
? lifeTimeScope.TryResolve(serviceType, out serviceInstance!)
: lifeTimeScope.TryResolveNamed(contract, serviceType, out serviceInstance!);

return serviceInstance;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Splat.Avalonia.Autofac/AvaloniaMixins.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static AppBuilder UseReactiveUIWithDIContainer<TContainer>(
#endif
var container = containerFactory();
Locator.CurrentMutable.RegisterConstant(container, typeof(TContainer));
Locator.CurrentMutable.RegisterConstant(container);
var dependencyResolver = dependencyResolverFactory(container);
Locator.SetLocator(dependencyResolver);
RxApp.MainThreadScheduler = AvaloniaScheduler.Instance;
Expand Down
1 change: 1 addition & 0 deletions src/Splat.Avalonia.Autofac/Splat.Avalonia.Autofac.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<ItemGroup>
<PackageReference Include="Avalonia.ReactiveUI" />
<PackageReference Include="Autofac" />
<PackageReference Include="System.Text.Json" />
<ProjectReference Include="..\Splat\Splat.csproj" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/Splat.Avalonia.DryIoc/AvaloniaMixins.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static AppBuilder UseReactiveUIWithDryIoc(this AppBuilder builder, Action
#endif
var container = new Container();
Locator.CurrentMutable.RegisterConstant(container, typeof(Container));
Locator.CurrentMutable.RegisterConstant(container);
Locator.SetLocator(new DryIocDependencyResolver(container));
RxApp.MainThreadScheduler = AvaloniaScheduler.Instance;
containerConfig(container);
Expand Down Expand Up @@ -98,7 +98,7 @@ public static AppBuilder UseReactiveUIWithDIContainer<TContainer>(
#endif
var container = containerFactory();
Locator.CurrentMutable.RegisterConstant(container, typeof(TContainer));
Locator.CurrentMutable.RegisterConstant(container);
var dependencyResolver = dependencyResolverFactory(container);
Locator.SetLocator(dependencyResolver);
RxApp.MainThreadScheduler = AvaloniaScheduler.Instance;
Expand Down
1 change: 1 addition & 0 deletions src/Splat.Avalonia.DryIoc/Splat.Avalonia.DryIoc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<ItemGroup>
<PackageReference Include="Avalonia.ReactiveUI" />
<PackageReference Include="DryIoc.Dll" />
<PackageReference Include="System.Text.Json" />
<ProjectReference Include="..\Splat\Splat.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn);1591;CA1707;SA1600;SA1601;SA1633;CA2000</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn);1591;CA1707;SA1600;SA1601;SA1633;CA2000</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static AppBuilder UseReactiveUIWithMicrosoftDependencyResolver(this AppBu
#endif
IServiceCollection serviceCollection = new ServiceCollection();
Locator.CurrentMutable.RegisterConstant(serviceCollection, typeof(IServiceCollection));
Locator.CurrentMutable.RegisterConstant(serviceCollection);
Locator.SetLocator(new MicrosoftDependencyResolver(serviceCollection));
RxApp.MainThreadScheduler = AvaloniaScheduler.Instance;
containerConfig(serviceCollection);
Expand Down Expand Up @@ -114,7 +114,7 @@ public static AppBuilder UseReactiveUIWithDIContainer<TContainer>(
#endif
var container = containerFactory();
Locator.CurrentMutable.RegisterConstant(container, typeof(TContainer));
Locator.CurrentMutable.RegisterConstant(container);
var dependencyResolver = dependencyResolverFactory(container);
Locator.SetLocator(dependencyResolver);
RxApp.MainThreadScheduler = AvaloniaScheduler.Instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<ItemGroup>
<PackageReference Include="Avalonia.ReactiveUI" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="System.Text.Json" />
<ProjectReference Include="..\Splat\Splat.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn);1591;CA1707;SA1600;SA1601;SA1633;CA2000</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn);1591;CA1707;SA1600;SA1601;SA1633;CA2000</NoWarn>
Expand Down
4 changes: 2 additions & 2 deletions src/Splat.Avalonia.Ninject/AvaloniaMixins.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static AppBuilder UseReactiveUIWithNinject(this AppBuilder builder, Actio
#endif
var container = new StandardKernel();
Locator.CurrentMutable.RegisterConstant(container, typeof(StandardKernel));
Locator.CurrentMutable.RegisterConstant(container);
Locator.SetLocator(new NinjectDependencyResolver(container));
RxApp.MainThreadScheduler = AvaloniaScheduler.Instance;
containerConfig(container);
Expand Down Expand Up @@ -98,7 +98,7 @@ public static AppBuilder UseReactiveUIWithDIContainer<TContainer>(
#endif
var container = containerFactory();
Locator.CurrentMutable.RegisterConstant(container, typeof(TContainer));
Locator.CurrentMutable.RegisterConstant(container);
var dependencyResolver = dependencyResolverFactory(container);
Locator.SetLocator(dependencyResolver);
RxApp.MainThreadScheduler = AvaloniaScheduler.Instance;
Expand Down
1 change: 1 addition & 0 deletions src/Splat.Avalonia.Ninject/Splat.Avalonia.Ninject.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<ItemGroup>
<PackageReference Include="Avalonia.ReactiveUI" />
<PackageReference Include="Ninject" />
<PackageReference Include="System.Text.Json" />
<ProjectReference Include="..\Splat\Splat.csproj" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Splat.Avalonia.Tests/Splat.Avalonia.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn);1591;CA1707;SA1600;SA1601;SA1633;CA2000</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion src/Splat.Common.Test/Splat.Common.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net8.0;net9.0</TargetFrameworks>
<NoWarn>$(NoWarn);CA2000</NoWarn>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Loading

0 comments on commit 154ef0f

Please sign in to comment.