Skip to content

Commit ecd97f3

Browse files
Net 9.0 target + test packages upgrade (#1002)
* Net 9.0 target + test packages upgrade * Fix flaky test
1 parent 6269c7d commit ecd97f3

8 files changed

+3160
-35
lines changed

.editorconfig

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@ dotnet_diagnostic.CA2009.severity=error
4343
dotnet_diagnostic.CA2008.severity=error
4444
dotnet_diagnostic.CA2007.severity=warning
4545
dotnet_diagnostic.CA2000.severity=suggestion
46+
dotnet_style_coalesce_expression = true:suggestion
47+
dotnet_style_null_propagation = true:suggestion
48+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
49+
dotnet_style_prefer_auto_properties = true:silent
50+
dotnet_style_object_initializer = true:suggestion
51+
dotnet_style_collection_initializer = true:suggestion
52+
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
53+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
54+
dotnet_style_prefer_conditional_expression_over_return = true:silent
55+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
56+
tab_width = 4
57+
end_of_line = crlf
58+
dotnet_style_explicit_tuple_names = true:suggestion
4659

4760
[project.json]
4861
indent_size = 2
@@ -66,7 +79,7 @@ csharp_indent_braces = false
6679
csharp_indent_case_contents = true
6780
csharp_indent_case_contents_when_block = true
6881
csharp_indent_switch_labels = true
69-
csharp_indent_labels = one_less_than_current
82+
csharp_indent_labels = no_change
7083

7184
# Modifier preferences
7285
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
@@ -117,13 +130,13 @@ dotnet_naming_style.camel_case_underscore_style.required_prefix = _
117130
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
118131

119132
# Code style defaults
120-
csharp_using_directive_placement = outside_namespace:suggestion
133+
csharp_using_directive_placement = outside_namespace:silent
121134
dotnet_sort_system_directives_first = true
122135
csharp_prefer_braces = true:silent
123136
csharp_preserve_single_line_blocks = true:none
124137
csharp_preserve_single_line_statements = false:none
125138
csharp_prefer_static_local_function = true:suggestion
126-
csharp_prefer_simple_using_statement = false:none
139+
csharp_prefer_simple_using_statement = true:suggestion
127140
csharp_style_prefer_switch_expression = true:suggestion
128141
csharp_style_namespace_declarations = block_scoped:silent
129142
csharp_style_prefer_method_group_conversion = true:silent
@@ -155,14 +168,14 @@ dotnet_style_prefer_simplified_interpolation = true:suggestion
155168
dotnet_style_namespace_match_folder = true:suggestion
156169

157170
# Expression-bodied members
158-
csharp_style_expression_bodied_methods = true:suggestion
159-
csharp_style_expression_bodied_constructors = true:suggestion
160-
csharp_style_expression_bodied_operators = true:suggestion
161-
csharp_style_expression_bodied_properties = true:suggestion
162-
csharp_style_expression_bodied_indexers = true:suggestion
163-
csharp_style_expression_bodied_accessors = true:suggestion
164-
csharp_style_expression_bodied_lambdas = true:suggestion
165-
csharp_style_expression_bodied_local_functions = true:suggestion
171+
csharp_style_expression_bodied_methods = false:silent
172+
csharp_style_expression_bodied_constructors = false:silent
173+
csharp_style_expression_bodied_operators = false:silent
174+
csharp_style_expression_bodied_properties = true:silent
175+
csharp_style_expression_bodied_indexers = true:silent
176+
csharp_style_expression_bodied_accessors = true:silent
177+
csharp_style_expression_bodied_lambdas = true:silent
178+
csharp_style_expression_bodied_local_functions = false:silent
166179

167180
# Pattern matching
168181
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
@@ -519,6 +532,7 @@ dotnet_diagnostic.RCS1195.severity=error
519532
dotnet_diagnostic.RCS1214.severity=error
520533

521534
dotnet_diagnostic.IDE1006.severity=none
535+
csharp_prefer_system_threading_lock = true:suggestion
522536

523537
# C++ Files
524538
[*.{cpp,h,in}]

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
</ItemGroup>
6565
<ItemGroup Condition="!$(IsTestProject) AND !$(IsBenchmarkProject)">
6666
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.556" PrivateAssets="all" />
67-
<PackageReference Include="Roslynator.Analyzers" Version="4.12.10" PrivateAssets="All" />
67+
<PackageReference Include="Roslynator.Analyzers" Version="4.13.1" PrivateAssets="All" />
6868
</ItemGroup>
6969
<ItemGroup Condition="!$(IsTestProject) AND !$(IsBenchmarkProject)">
7070
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" />

src/Directory.build.targets

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,7 @@
3434
<PropertyGroup Condition="$(TargetFramework.StartsWith('net8'))">
3535
<DefineConstants>$(DefineConstants);NETSTANDARD;PORTABLE;P_LINQ;SUPPORTS_BINDINGLIST</DefineConstants>
3636
</PropertyGroup>
37+
<PropertyGroup Condition="$(TargetFramework.StartsWith('net9'))">
38+
<DefineConstants>$(DefineConstants);NETSTANDARD;PORTABLE;P_LINQ;SUPPORTS_BINDINGLIST</DefineConstants>
39+
</PropertyGroup>
3740
</Project>

src/DynamicData.Tests/API/ApiApprovalTests.DynamicDataTests.DotNet9_0.verified.txt

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

src/DynamicData.Tests/Binding/ObservableCollectionToChangeSetFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void Add()
2828
{
2929
_collection.Add(1);
3030

31-
_results.Messages.Count.Should().BeGreaterOrEqualTo(1);
31+
_results.Messages.Count.Should().BeGreaterThanOrEqualTo(1);
3232
_results.Data.Count.Should().Be(1);
3333
_results.Data.Items[0].Should().Be(1);
3434
}

src/DynamicData.Tests/Cache/TransformAsyncFixture.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ public void Remove()
9090
[Fact]
9191
public async Task RemoveFlowsToTheEnd()
9292
{
93-
var transform = 0;
9493
var count = 100;
9594
ReadOnlyObservableCollection<Person> collection;
9695

@@ -100,15 +99,8 @@ public async Task RemoveFlowsToTheEnd()
10099
cache.Connect()
101100
.TransformAsync(async person =>
102101
{
103-
try
104-
{
105-
await Task.Delay(Random.Shared.Next(1, 12));
106-
return person;
107-
}
108-
finally
109-
{
110-
transform++;
111-
}
102+
await Task.Delay(Random.Shared.Next(1, 12));
103+
return person;
112104
})
113105
.Bind(out collection)
114106
.Subscribe();
@@ -119,8 +111,11 @@ public async Task RemoveFlowsToTheEnd()
119111
cache.RemoveKey(p.Name);
120112
}
121113

122-
await collection.ToObservableChangeSet().Take(count * 2);
114+
// Add one event as an initial empty change set is sent
115+
// NOTE TO SELF: How did this test previously work !
116+
var changes = await collection.ToObservableChangeSet().Take(count * 2 + 1).ToList();
123117

118+
changes.Count.Should().Be(201);
124119
collection.Count.Should().Be(0);
125120
}
126121

src/DynamicData.Tests/DynamicData.Tests.csproj

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
<Project Sdk="MSBuild.Sdk.Extras">
22
<PropertyGroup>
3-
<TargetFrameworks>net8.0</TargetFrameworks>
3+
<TargetFrameworks>net9.0</TargetFrameworks>
44
<NoWarn>$(NoWarn);CS0618;CA1801;CA1812;CA1816;CA1062;CA1063;CS8767;CS8602;CS8618;IDE1006</NoWarn>
5-
<XunitVersion>2.7.0</XunitVersion>
5+
<XunitVersion>2.*</XunitVersion>
66
</PropertyGroup>
77

88
<ItemGroup>
99
<ProjectReference Include="..\DynamicData\DynamicData.csproj" />
1010
</ItemGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Bogus" Version="35.6.0" />
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
13+
<PackageReference Include="Bogus" Version="35.*" />
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.*" />
1515
<PackageReference Include="xunit" Version="$(XunitVersion)" />
1616
<PackageReference Include="xunit.runner.console" Version="$(XunitVersion)" />
17-
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0" />
18-
<PackageReference Include="Verify.Xunit" Version="23.7.2" />
19-
<PackageReference Include="FluentAssertions" Version="6.12.2" />
20-
<PackageReference Include="Microsoft.Reactive.Testing" Version="6.0.1" />
21-
<PackageReference Include="PublicApiGenerator" Version="11.1.0" />
22-
<PackageReference Include="coverlet.collector" Version="6.0.2">
17+
<PackageReference Include="xunit.runner.visualstudio" Version="3.*" />
18+
<PackageReference Include="Verify.Xunit" Version="30.*" />
19+
<PackageReference Include="AwesomeAssertions" Version="8.*" />
20+
<PackageReference Include="Microsoft.Reactive.Testing" Version="6.*" />
21+
<PackageReference Include="PublicApiGenerator" Version="11.*" />
22+
<PackageReference Include="coverlet.collector" Version="6.*">
2323
<PrivateAssets>all</PrivateAssets>
2424
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
2525
</PackageReference>

src/DynamicData/DynamicData.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netstandard2.0;net462;net6.0;net7.0;net8.0</TargetFrameworks>
3+
<TargetFrameworks>netstandard2.0;net462;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
44
<GenerateDocumentationFile>true</GenerateDocumentationFile>
55
<IsPackable>true</IsPackable>
66
<ImplicitUsings>enable</ImplicitUsings>

0 commit comments

Comments
 (0)