Skip to content

Commit 656f625

Browse files
authored
Move to .NET SDK 9.0.300 (#2208)
Unit tests now run on net9.0 (and continue to run on net8.0, net472, and UWP) Removed .net6.0 and .net7.0 targets from test runner because those runtimes are out of support Removed dependency on MSBuild.SDK.Extras
1 parent ebab5fc commit 656f625

File tree

44 files changed

+1986
-1560
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1986
-1560
lines changed

Rx.NET/Documentation/adr/0003-uap-targets.md

Lines changed: 190 additions & 0 deletions
Large diffs are not rendered by default.

Rx.NET/Source/src/.editorconfig renamed to Rx.NET/Source/.editorconfig

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,18 @@
3434
# reported as unnecessary on ObservableEx, but it is, so we've squelched it.
3535
# IL2060 is considered unnecessary on targets that don't support trimming, but we don't want to wrap every
3636
# single one in a conditional, so we also suppress warnings about unnecessary suppressions on those.
37-
dotnet_remove_unnecessary_suppression_exclusions = CA1704,CA1711,IL2060
37+
#
38+
# dotnet_remove_unnecessary_suppression_exclusions = CA1704,CA1711,IL2060
39+
#
40+
# Since moving to .NET SDK 9.0, we now get a lot more of these inexplicable IDE0079 warnings, where
41+
# if we remove the suppression that it complains about, we immediately get the warning that the suppression
42+
# is there to prevent. As far as I can tell, every suppression now causes a spurious IDE0079, so we
43+
# just have to disable IDE0079. Presumably there's something odd about this codebase that is confusing
44+
# the IDE0079 diagnostic - it can't be completely broken for everyone, because someone would have
45+
# noticed. I guess this may be related to the curse placed on this codebase by The Great Unification,
46+
# and in particular the corresponding requirement for putting a uap10.0.xxxx TFM on packages that
47+
# really shouldn't have them.
48+
dotnet_diagnostic.IDE0079.severity = silent
3849

3950

4051
# Prevent IDE1006 (Naming rule violation) errors for non-public fields.
@@ -68,3 +79,5 @@ dotnet_naming_symbols.protected_field_symbols.applicable_accessibilities = prote
6879
dotnet_naming_rule.protected_instance_fields_must_be_camel_cased_underscore_prefix.symbols = protected_field_symbols
6980
dotnet_naming_rule.protected_instance_fields_must_be_camel_cased_underscore_prefix.style = camel_case_and_prefix_with_underscore_style
7081
dotnet_naming_rule.protected_instance_fields_must_be_camel_cased_underscore_prefix.severity = none
82+
83+
dotnet_style_require_accessibility_modifiers = for_non_interface_members

Rx.NET/Source/Directory.build.props

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
-->
4040
<PackageReference
4141
Include="Nerdbank.GitVersioning"
42-
Version="3.6.128"
42+
Version="3.6.143"
4343
PrivateAssets="all"
4444
Condition="$(ProjectName) != 'Tests.System.Reactive.Uwp.DeviceRunner'" />
4545
</ItemGroup>
@@ -52,6 +52,27 @@
5252
<PackageReference Include="coverlet.collector" Version="3.2.0" />
5353
</ItemGroup>
5454

55+
56+
<PropertyGroup Condition="'$(TargetFramework)'=='uap10.0.18362'">
57+
<!--
58+
See 0003-uap-targets.md ADR in documentation for the reasons behind these settings.
59+
-->
60+
<NoStdLib>True</NoStdLib>
61+
62+
<TargetPlatformMinVersion>10.0.18362</TargetPlatformMinVersion>
63+
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
64+
65+
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
66+
<TargetFrameworkMoniker>.NETCore,Version=v5.0</TargetFrameworkMoniker>
67+
<TargetFrameworkIdentifier>.NETCore</TargetFrameworkIdentifier>
68+
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
69+
<NugetTargetMoniker>UAP,Version=v10.0</NugetTargetMoniker>
70+
71+
<DefineConstants>$(DefineConstants);WINDOWS_UWP</DefineConstants>
72+
73+
</PropertyGroup>
74+
75+
5576
<PropertyGroup>
5677
<AnalysisLevelDesign>7.0-default</AnalysisLevelDesign>
5778
<AnalysisLevelNaming>7.0-all</AnalysisLevelNaming>
@@ -72,9 +93,16 @@
7293
a chance to shut down. Each of these likely needs individual review:
7394
https://github.com/dotnet/reactive/issues/1927
7495
96+
IDE0028 - Suggests Collection expressions in place of construction, e.g. replaces new List<int>(x)
97+
[.. x]. To me, this is less readable, and it doesn't improve performance, as far as we know.
98+
Annoyingly, we don't seem to be able to configure this to apply only when it would not
99+
introduce a spread.
75100
IDE0056 - Use of index/range syntax - relevant types not available on all targets, so we can't
76101
IDE0057 do this.
77102
103+
IDE0130 - Namespace does not match folder structure. Conforming to this would be a significant
104+
upheaval, and it's not clear that it would be an improvement.
105+
78106
IDE0290 - Primary ctors. This diagnostic suggests them in a lot of places where we don't want
79107
them. E.g., in most types with multiple constructors I find I prefer not to have
80108
a primary ctor. Since this is all or nothing, we turn it off.
@@ -84,11 +112,13 @@
84112
[.. readyList]
85113
This won't improve performance as far as we know (sometimes a reason for using that
86114
syntax), and it's not obviously an improvement in readability.
115+
IDE0306 - Suggests Collection expressions in place of construction, e.g. replaces new List<int>(x)
116+
[.. x]. To me, this is less readable, and it doesn't improve performance, as far as we know.
87117
88118
CA1510 - use ArgumentNullException.ThrowIf (not available on all targets)
89119
CA1513 - use ObjectDisposedException.ThrowIf (not available on all targets)
90120
-->
91-
<NoWarn>$(NoWarn);CA1001;CA2213;CA1510;CA1513;IDE0056;IDE0057;IDE0290;IDE0305</NoWarn>
121+
<NoWarn>$(NoWarn);CA1001;CA2213;CA1510;CA1513;IDE0028;IDE0056;IDE0057;IDE0130;IDE0290;IDE0305;IDE0306</NoWarn>
92122
</PropertyGroup>
93123

94124
<ItemGroup>

Rx.NET/Source/Directory.build.targets

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,39 @@
1111
</PropertyGroup>
1212
<PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0.18362'">
1313
<DefineConstants>$(DefineConstants);HAS_WINRT;WINDOWS;HAS_OS_XAML;LEGACY_WINRT;NO_NULLABLE_ATTRIBUTES</DefineConstants>
14-
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
1514
</PropertyGroup>
1615
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
1716
<DefineConstants>$(DefineConstants);HAS_WINRT;NO_NULLABLE_ATTRIBUTES</DefineConstants>
1817
</PropertyGroup>
1918
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0')) or $(TargetFramework.StartsWith('net7.0')) or $(TargetFramework.StartsWith('net8.0'))">
2019
<DefineConstants>$(DefineConstants);HAS_TRIMMABILITY_ATTRIBUTES</DefineConstants>
2120
</PropertyGroup>
22-
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0-windows')) or $(TargetFramework.StartsWith('net7.0-windows')) or $(TargetFramework.StartsWith('net8.0-windows'))">
21+
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0-windows')) or $(TargetFramework.StartsWith('net8.0-windows')) or $(TargetFramework.StartsWith('net9.0-windows'))">
2322
<DefineConstants>$(DefineConstants);HAS_WINRT;HAS_WINFORMS;HAS_WPF;HAS_DISPATCHER;DESKTOPCLR;WINDOWS;CSWINRT</DefineConstants>
2423
</PropertyGroup>
2524

2625
<ItemGroup Condition="'$(TargetFramework)' == 'net472' or '$(TargetFramework)' == 'uap10.0.18362' or '$(TargetFramework)' == 'netstandard2.0'">
2726
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
2827
</ItemGroup>
2928

29+
<ItemGroup Condition="'$(TargetFramework)'=='uap10.0.18362'">
30+
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform"
31+
Version="6.2.14" />
32+
</ItemGroup>
33+
34+
35+
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0-windows')) or $(TargetFramework.StartsWith('net8.0-windows')) or $(TargetFramework.StartsWith('net9.0-windows'))">
36+
<!--
37+
In the 9.0.100-rc.2.24474.11 SDK, the build tools attempt to perform code generation for a whole load of our types to support WinRT interop.
38+
It's looking like it does this for any public type that implements IDisposable!
39+
It's possible that this is a bug in the SDK, but it's also possible that this will be resolved as by design.
40+
For the .NET 9.0 RC2 SDK at least, we need to opt out the CsWinRT AOT optimizer.
41+
We need to check whether this is definitely OK. I think this is only meant for types that are intended to be used from WinRT,
42+
which isn't the case here, but we need to verify this.
43+
-->
44+
<CsWinRTAotOptimizerEnabled>false</CsWinRTAotOptimizerEnabled>
45+
</PropertyGroup>
46+
3047
<Target Name="AddCommitHashToAssemblyAttributes" BeforeTargets="GetAssemblyAttributes">
3148
<ItemGroup>
3249
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition=" '$(SourceRevisionId)' != '' ">

0 commit comments

Comments
 (0)