diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 1490bfb3..50e19095 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "docfx": { - "version": "2.81.0", + "version": "2.82.0", "commands": [ "docfx" ], diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 01fda1f4..3f6ba3a4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -73,7 +73,7 @@ jobs: - name: Run the tests (${{ matrix.name }}) env: ODX_REQUIRE_SQL: 1 - run: dotnet test Tests/Open.Database.Extensions.Core.Tests -c ${{ matrix.configuration }} -f ${{ matrix.tfm }} --logger "trx;LogFileName=${{ matrix.name }}.trx" --results-directory TestResults/${{ matrix.name }} + run: dotnet test --project Tests/Open.Database.Extensions.Core.Tests -c ${{ matrix.configuration }} -f ${{ matrix.tfm }} --report-xunit-trx --report-xunit-trx-filename ${{ matrix.name }}.trx --results-directory TestResults/${{ matrix.name }} - name: Upload the TRX files if: always() @@ -118,11 +118,11 @@ jobs: $failed = @() $started = Get-Date foreach ($framework in $frameworks) { - dotnet test $project -c Release --no-build -f $framework --logger "trx;LogFilePrefix=legacy-compiler-$framework" --results-directory TestResults/legacy-compiler + dotnet test --project $project -c Release --no-build -f $framework --report-xunit-trx --report-xunit-trx-filename "legacy-compiler-$framework.trx" --results-directory TestResults/legacy-compiler $exitCode = $LASTEXITCODE # `dotnet test --no-build -f` exits 0 without running anything for a target framework that was not built, so a missing TRX file is a failure too, # and so is a TRX file that counts no tests. - $results = @(Get-ChildItem TestResults/legacy-compiler -Filter "legacy-compiler-${framework}_*.trx" -ErrorAction SilentlyContinue | Where-Object LastWriteTime -ge $started) + $results = @(Get-ChildItem TestResults/legacy-compiler -Filter "legacy-compiler-$framework.trx" -ErrorAction SilentlyContinue | Where-Object LastWriteTime -ge $started) $total = 0 foreach ($result in $results) { $total += [int]([xml](Get-Content -Raw $result.FullName)).TestRun.ResultSummary.Counters.total } if ($exitCode -ne 0 -or -not $results -or $total -eq 0) { @@ -173,7 +173,13 @@ jobs: - name: Run the generator tests env: ODX_REQUIRE_SQL: 1 - run: dotnet test Tests/Open.Database.Extensions.Generator.Tests -c Release --logger "trx;LogFilePrefix=generator" --results-directory TestResults/generator + run: dotnet test --project Tests/Open.Database.Extensions.Generator.Tests -c Release --report-xunit-trx --report-xunit-trx-filename generator.trx --results-directory TestResults/generator + + # The same tests against the generator built on Roslyn 5.12 (Source/Generator.Roslyn5); Core packs both builds. + - name: Run the generator tests on the Roslyn 5.12 build + env: + ODX_REQUIRE_SQL: 1 + run: dotnet test --project Tests/Open.Database.Extensions.Generator.Tests -c Release -p:OdxGeneratorRoslyn=5.12 --report-xunit-trx --report-xunit-trx-filename generator-roslyn5.12.trx --results-directory TestResults/generator-roslyn5.12 # What a NuGet user gets: the packages are packed, and a project that references only them is built and run with the generator on, # arriving through MSSqlClient alone, switched off, and with C# 12. It runs on net472 and net11.0, against LocalDB and SQLite. @@ -182,6 +188,8 @@ jobs: ODX_REQUIRE_SQL: 1 run: | $suffix = "ci.${{ github.run_id }}.${{ github.run_attempt }}" + # The version prefix of Source/Directory.Build.props, so a version change there never leaves this step behind. + $prefix = ([xml](Get-Content Source/Directory.Build.props -Raw)).Project.PropertyGroup.VersionPrefix | Where-Object { $_ } | Select-Object -First 1 $feed = Join-Path $env:RUNNER_TEMP 'feed' $siblings = 'MSSqlClient', 'Channel', 'Dataflow', 'Extensions' foreach ($project in @('Core') + $siblings) { @@ -193,12 +201,12 @@ jobs: # The Core package carries the generator and its build targets, and no sibling package holds them back from its consumers. Add-Type -AssemblyName System.IO.Compression.FileSystem function Read-Package($id) { - $path = Join-Path $feed "$id.11.0.0-$suffix.nupkg" + $path = Join-Path $feed "$id.$prefix-$suffix.nupkg" [IO.Compression.ZipFile]::OpenRead($path) } $core = Read-Package 'Open.Database.Extensions.Core' try { - foreach ($entry in 'analyzers/dotnet/roslyn4.14/cs/Open.Database.Extensions.Generator.dll', 'buildTransitive/Open.Database.Extensions.Core.targets') { + foreach ($entry in 'analyzers/dotnet/roslyn4.14/cs/Open.Database.Extensions.Generator.dll', 'analyzers/dotnet/roslyn5.12/cs/Open.Database.Extensions.Generator.dll', 'buildTransitive/Open.Database.Extensions.Core.targets') { if (-not $core.GetEntry($entry)) { throw "The Core package has no $entry" } } } finally { $core.Dispose() } @@ -217,12 +225,20 @@ jobs: $variants = [ordered]@{ core = @(); mssqlclient = @('-p:OdxVia=MSSqlClient'); off = @('-p:OdxGenerateMaps=false'); csharp12 = @('-p:LangVersion=12') } $failed = @() foreach ($variant in $variants.Keys) { - $options = @("-p:OdxFeed=$feed", "-p:OdxPackageVersion=11.0.0-$suffix") + $variants[$variant] + $options = @("-p:OdxFeed=$feed", "-p:OdxPackageVersion=$prefix-$suffix") + $variants[$variant] $consumer = 'Tests/Open.Database.Extensions.PackageConsumer.Tests' dotnet build $consumer -c Release --no-incremental @options if ($LASTEXITCODE -ne 0) { $failed += "$variant (build)"; continue } - dotnet test $consumer -c Release --no-build @options --logger "trx;LogFilePrefix=$variant" --results-directory TestResults/consumer - if ($LASTEXITCODE -ne 0) { $failed += $variant } + # The compiler of this SDK (global.json) supports Roslyn 5.12, so NuGet must hand it the generator in the roslyn5.12 folder, not the roslyn4.14 one. + if ($variant -in 'core', 'mssqlclient') { + $analyzers = (dotnet msbuild $consumer '-t:ResolvePackageAssets;ResolveLockFileAnalyzers' -getItem:Analyzer -p:Configuration=Release -p:TargetFramework=net11.0 @options | ConvertFrom-Json).Items.Analyzer.Identity + if (-not ($analyzers -like '*roslyn5.12*Open.Database.Extensions.Generator.dll')) { $failed += "$variant (the roslyn5.12 generator was not selected: $($analyzers -join ', '))"; continue } + } + # One run per target framework: a run of both writes the same TRX file twice, and the second overwrites the first. + foreach ($framework in 'net472', 'net11.0') { + dotnet test --project $consumer -c Release --no-build -f $framework @options --report-xunit-trx --report-xunit-trx-filename "$variant-$framework.trx" --results-directory TestResults/consumer + if ($LASTEXITCODE -ne 0) { $failed += "$variant ($framework)" } + } } if ($failed.Count -gt 0) { throw "Package consumer tests failed: $($failed -join ', ')" } @@ -233,6 +249,7 @@ jobs: name: trx-generator path: | TestResults/generator/*.trx + TestResults/generator-roslyn5.12/*.trx TestResults/consumer/*.trx benchmarks-build: @@ -280,7 +297,7 @@ jobs: $projects = @( 'Source\Core', 'Source\MSSqlClient', 'Source\Channel', 'Source\Dataflow', 'Source\Extensions', 'Tests\Open.Database.Extensions.Core.Tests', 'Tests\Open.Database.Extensions.LegacyCompiler.Tests', 'docsite\samples', 'Benchmarks\Open.Database.Extensions.Benchmarks', - 'Source\Generator', 'Tests\Open.Database.Extensions.Generator.Models', 'Tests\Open.Database.Extensions.Generator.Tests', 'Benchmarks\Open.Database.Extensions.Benchmarks.Generated') + 'Source\Generator', 'Source\Generator.Roslyn5', 'Tests\Open.Database.Extensions.Generator.Models', 'Tests\Open.Database.Extensions.Generator.Tests', 'Benchmarks\Open.Database.Extensions.Benchmarks.Generated') $failures = @() foreach ($project in $projects) { # A full Windows path: with forward slashes the formatter loads nothing and reports a false zero. diff --git a/Benchmarks/Open.Database.Extensions.Benchmarks/Open.Database.Extensions.Benchmarks.csproj b/Benchmarks/Open.Database.Extensions.Benchmarks/Open.Database.Extensions.Benchmarks.csproj index ce1048fd..db262562 100644 --- a/Benchmarks/Open.Database.Extensions.Benchmarks/Open.Database.Extensions.Benchmarks.csproj +++ b/Benchmarks/Open.Database.Extensions.Benchmarks/Open.Database.Extensions.Benchmarks.csproj @@ -23,14 +23,14 @@ - - - - - - - - + + + + + + + + diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 00000000..c1ead25e --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,76 @@ + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Open.Database.Extensions.slnx b/Open.Database.Extensions.slnx index 73dd25c4..2db87f11 100644 --- a/Open.Database.Extensions.slnx +++ b/Open.Database.Extensions.slnx @@ -1,6 +1,7 @@ + @@ -15,5 +16,6 @@ + diff --git a/Source/Channel/Open.Database.Extensions.Channel.csproj b/Source/Channel/Open.Database.Extensions.Channel.csproj index 251d1873..d77173ad 100644 --- a/Source/Channel/Open.Database.Extensions.Channel.csproj +++ b/Source/Channel/Open.Database.Extensions.Channel.csproj @@ -6,13 +6,13 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Source/Core/Open.Database.Extensions.Core.csproj b/Source/Core/Open.Database.Extensions.Core.csproj index 9d837a28..41949327 100644 --- a/Source/Core/Open.Database.Extensions.Core.csproj +++ b/Source/Core/Open.Database.Extensions.Core.csproj @@ -7,7 +7,7 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + + + @@ -43,22 +46,22 @@ - + - + - - + + - + - - + + diff --git a/Source/Core/PublicAPI.Shipped.txt b/Source/Core/PublicAPI.Shipped.txt index 77162a50..22515341 100644 --- a/Source/Core/PublicAPI.Shipped.txt +++ b/Source/Core/PublicAPI.Shipped.txt @@ -1020,3 +1020,50 @@ Open.Database.Extensions.MappedQueryWithSkip.CaptureOutputDecimal(out Open.Da Open.Database.Extensions.MappedQueryWithTake.CaptureOutput(out Open.Database.Extensions.DbCapture output, string? name = null) -> Open.Database.Extensions.MappedQueryWithTake Open.Database.Extensions.MappedQueryWithTake.CaptureOutput(out Open.Database.Extensions.DbCapture value, byte precision, byte scale, string? name = null) -> Open.Database.Extensions.MappedQueryWithTake Open.Database.Extensions.MappedQueryWithTake.CaptureOutputDecimal(out Open.Database.Extensions.DbCapture value, byte precision, byte scale, string? name = null) -> Open.Database.Extensions.MappedQueryWithTake +~Open.Database.Extensions.ExpressiveCommandBase.Param.Equals(Open.Database.Extensions.ExpressiveCommandBase.Param other) -> bool +~override Open.Database.Extensions.ColumnOrdinal.Equals(object obj) -> bool +~override Open.Database.Extensions.ExpressiveCommandBase.Param.Equals(object obj) -> bool +~override Open.Database.Extensions.ExpressiveCommandBase.Param.ToString() -> string +~override Open.Database.Extensions.MappedCommand.Equals(object obj) -> bool +~override Open.Database.Extensions.MappedCommand.ToString() -> string +~override Open.Database.Extensions.MappedQuery.Equals(object obj) -> bool +~override Open.Database.Extensions.MappedQuery.ToString() -> string +~override Open.Database.Extensions.MappedQueryWithSkip.Equals(object obj) -> bool +~override Open.Database.Extensions.MappedQueryWithSkip.ToString() -> string +~override Open.Database.Extensions.MappedQueryWithTake.Equals(object obj) -> bool +~override Open.Database.Extensions.MappedQueryWithTake.ToString() -> string +~override Open.Database.Extensions.MappedReader.Equals(object obj) -> bool +~override Open.Database.Extensions.MappedReader.ToString() -> string +~override Open.Database.Extensions.MappedTable.Equals(object obj) -> bool +~override Open.Database.Extensions.MappedTable.ToString() -> string +~static Open.Database.Extensions.ExpressiveCommandBase.Param.operator !=(Open.Database.Extensions.ExpressiveCommandBase.Param left, Open.Database.Extensions.ExpressiveCommandBase.Param right) -> bool +~static Open.Database.Extensions.ExpressiveCommandBase.Param.operator ==(Open.Database.Extensions.ExpressiveCommandBase.Param left, Open.Database.Extensions.ExpressiveCommandBase.Param right) -> bool +Open.Database.Extensions.ColumnOrdinal.Equals(Open.Database.Extensions.ColumnOrdinal other) -> bool +Open.Database.Extensions.MappedCommand.Equals(Open.Database.Extensions.MappedCommand other) -> bool +Open.Database.Extensions.MappedQuery.Equals(Open.Database.Extensions.MappedQuery other) -> bool +Open.Database.Extensions.MappedQueryWithSkip.Equals(Open.Database.Extensions.MappedQueryWithSkip other) -> bool +Open.Database.Extensions.MappedQueryWithTake.Equals(Open.Database.Extensions.MappedQueryWithTake other) -> bool +Open.Database.Extensions.MappedReader.Equals(Open.Database.Extensions.MappedReader other) -> bool +Open.Database.Extensions.MappedTable.Equals(Open.Database.Extensions.MappedTable other) -> bool +override Open.Database.Extensions.ColumnOrdinal.GetHashCode() -> int +override Open.Database.Extensions.ExpressiveCommandBase.Param.GetHashCode() -> int +override Open.Database.Extensions.MappedCommand.GetHashCode() -> int +override Open.Database.Extensions.MappedQuery.GetHashCode() -> int +override Open.Database.Extensions.MappedQueryWithSkip.GetHashCode() -> int +override Open.Database.Extensions.MappedQueryWithTake.GetHashCode() -> int +override Open.Database.Extensions.MappedReader.GetHashCode() -> int +override Open.Database.Extensions.MappedTable.GetHashCode() -> int +static Open.Database.Extensions.ColumnOrdinal.operator !=(Open.Database.Extensions.ColumnOrdinal left, Open.Database.Extensions.ColumnOrdinal right) -> bool +static Open.Database.Extensions.ColumnOrdinal.operator ==(Open.Database.Extensions.ColumnOrdinal left, Open.Database.Extensions.ColumnOrdinal right) -> bool +static Open.Database.Extensions.MappedCommand.operator !=(Open.Database.Extensions.MappedCommand left, Open.Database.Extensions.MappedCommand right) -> bool +static Open.Database.Extensions.MappedCommand.operator ==(Open.Database.Extensions.MappedCommand left, Open.Database.Extensions.MappedCommand right) -> bool +static Open.Database.Extensions.MappedQuery.operator !=(Open.Database.Extensions.MappedQuery left, Open.Database.Extensions.MappedQuery right) -> bool +static Open.Database.Extensions.MappedQuery.operator ==(Open.Database.Extensions.MappedQuery left, Open.Database.Extensions.MappedQuery right) -> bool +static Open.Database.Extensions.MappedQueryWithSkip.operator !=(Open.Database.Extensions.MappedQueryWithSkip left, Open.Database.Extensions.MappedQueryWithSkip right) -> bool +static Open.Database.Extensions.MappedQueryWithSkip.operator ==(Open.Database.Extensions.MappedQueryWithSkip left, Open.Database.Extensions.MappedQueryWithSkip right) -> bool +static Open.Database.Extensions.MappedQueryWithTake.operator !=(Open.Database.Extensions.MappedQueryWithTake left, Open.Database.Extensions.MappedQueryWithTake right) -> bool +static Open.Database.Extensions.MappedQueryWithTake.operator ==(Open.Database.Extensions.MappedQueryWithTake left, Open.Database.Extensions.MappedQueryWithTake right) -> bool +static Open.Database.Extensions.MappedReader.operator !=(Open.Database.Extensions.MappedReader left, Open.Database.Extensions.MappedReader right) -> bool +static Open.Database.Extensions.MappedReader.operator ==(Open.Database.Extensions.MappedReader left, Open.Database.Extensions.MappedReader right) -> bool +static Open.Database.Extensions.MappedTable.operator !=(Open.Database.Extensions.MappedTable left, Open.Database.Extensions.MappedTable right) -> bool +static Open.Database.Extensions.MappedTable.operator ==(Open.Database.Extensions.MappedTable left, Open.Database.Extensions.MappedTable right) -> bool diff --git a/Source/Dataflow/Open.Database.Extensions.Dataflow.csproj b/Source/Dataflow/Open.Database.Extensions.Dataflow.csproj index 9d645be9..cd418210 100644 --- a/Source/Dataflow/Open.Database.Extensions.Dataflow.csproj +++ b/Source/Dataflow/Open.Database.Extensions.Dataflow.csproj @@ -6,17 +6,17 @@ - + - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Source/Directory.Build.props b/Source/Directory.Build.props index 48a5f8d7..90691406 100644 --- a/Source/Directory.Build.props +++ b/Source/Directory.Build.props @@ -3,7 +3,7 @@ Open.Database.Extensions - 11.0.0 + 11.0.1 debug + + + netstandard2.0 + false + false + false + false + true + true + Open.Database.Extensions.Generator + Open.Database.Extensions.Generator + $(NoWarn);RSEXPERIMENTAL002;NU5128 + + + + + + + + + + + + diff --git a/Source/Generator/Open.Database.Extensions.Generator.csproj b/Source/Generator/Open.Database.Extensions.Generator.csproj index 16362558..44ee5cdd 100644 --- a/Source/Generator/Open.Database.Extensions.Generator.csproj +++ b/Source/Generator/Open.Database.Extensions.Generator.csproj @@ -22,8 +22,8 @@ - - + + diff --git a/Source/MSSqlClient/Open.Database.Extensions.MSSqlClient.csproj b/Source/MSSqlClient/Open.Database.Extensions.MSSqlClient.csproj index 85e1d3f6..25c35c8a 100644 --- a/Source/MSSqlClient/Open.Database.Extensions.MSSqlClient.csproj +++ b/Source/MSSqlClient/Open.Database.Extensions.MSSqlClient.csproj @@ -7,21 +7,21 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/Source/SqlClient/Open.Database.Extensions.SqlClient.csproj b/Source/SqlClient/Open.Database.Extensions.SqlClient.csproj index cda1a90e..19c5ac1e 100644 --- a/Source/SqlClient/Open.Database.Extensions.SqlClient.csproj +++ b/Source/SqlClient/Open.Database.Extensions.SqlClient.csproj @@ -8,11 +8,11 @@ - + - + diff --git a/Tests/Open.Database.Extensions.Core.Tests/ExpressiveCommandParamTests.cs b/Tests/Open.Database.Extensions.Core.Tests/ExpressiveCommandParamTests.cs index e1a64a07..6aad01ce 100644 --- a/Tests/Open.Database.Extensions.Core.Tests/ExpressiveCommandParamTests.cs +++ b/Tests/Open.Database.Extensions.Core.Tests/ExpressiveCommandParamTests.cs @@ -59,8 +59,8 @@ public static void AddParam_NullInputValue_BecomesDBNull() { ExpressiveCommand cmd = NewCommand().AddParam("a", (object?)null); - Assert.Single(cmd.Params); - Assert.Equal(DBNull.Value, cmd.Params[0].Value); + var param = Assert.Single(cmd.Params); + Assert.Equal(DBNull.Value, param.Value); } [Fact] @@ -70,8 +70,8 @@ public static void AddParamIf_OnlyAddsWhenConditionTrue() .AddParamIf(false, "skip", 1) .AddParamIf(true, "keep", 2); - Assert.Single(cmd.Params); - Assert.Equal("keep", cmd.Params[0].Name); + var param = Assert.Single(cmd.Params); + Assert.Equal("keep", param.Name); } [Fact] diff --git a/Tests/Open.Database.Extensions.Core.Tests/MappedDbQueryTests.cs b/Tests/Open.Database.Extensions.Core.Tests/MappedDbQueryTests.cs index b9031642..3a29a21f 100644 --- a/Tests/Open.Database.Extensions.Core.Tests/MappedDbQueryTests.cs +++ b/Tests/Open.Database.Extensions.Core.Tests/MappedDbQueryTests.cs @@ -460,9 +460,9 @@ public static async Task ParamsAfterUsing_KeepTheOptions_AndLeaveTheViewItCameFr Assert.Equal([5], single); Assert.NotEqual(view, withParam); - Assert.IsType(view.Command); - Assert.IsType(withParam.Command); - Assert.NotEqual((DbQueryCall)view.Command, (DbQueryCall)withParam.Command); + DbQueryCall viewCall = Assert.IsType(view.Command); + DbQueryCall withParamCall = Assert.IsType(withParam.Command); + Assert.NotEqual(viewCall, withParamCall); } [Fact] diff --git a/Tests/Open.Database.Extensions.Core.Tests/Open.Database.Extensions.Core.Tests.csproj b/Tests/Open.Database.Extensions.Core.Tests/Open.Database.Extensions.Core.Tests.csproj index 22836992..3361e744 100644 --- a/Tests/Open.Database.Extensions.Core.Tests/Open.Database.Extensions.Core.Tests.csproj +++ b/Tests/Open.Database.Extensions.Core.Tests/Open.Database.Extensions.Core.Tests.csproj @@ -1,4 +1,4 @@ - + net11.0 @@ -6,20 +6,21 @@ Exe false true - $(NoWarn);IDE0079;CS8632 + + $(NoWarn);IDE0079;CS8632;xUnit1069 - - - - - - + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Tests/Open.Database.Extensions.Core.Tests/RowsFormTests.cs b/Tests/Open.Database.Extensions.Core.Tests/RowsFormTests.cs index ec7387a6..e5c8066d 100644 --- a/Tests/Open.Database.Extensions.Core.Tests/RowsFormTests.cs +++ b/Tests/Open.Database.Extensions.Core.Tests/RowsFormTests.cs @@ -118,8 +118,8 @@ public static async Task DictionaryRow_OfTwoColumnsWithTheSameName_FirstWins_And Assert.Equal(1L, row["id"]); Assert.Equal(1L, row[0]); Assert.Equal(2L, row[1]); - Assert.Single(row); - Assert.Equal(KeyValuePair.Create("id", 1L), row.Single()); + var only = Assert.Single(row); + Assert.Equal(KeyValuePair.Create("id", 1L), only); var copy = row.ToDictionary(); Assert.Equal(1L, Assert.Single(copy).Value); Assert.Throws(() => row[2]); diff --git a/Tests/Open.Database.Extensions.Core.Tests/StallStreamTests.cs b/Tests/Open.Database.Extensions.Core.Tests/StallStreamTests.cs index 0b3ca1bf..f64c2ed4 100644 --- a/Tests/Open.Database.Extensions.Core.Tests/StallStreamTests.cs +++ b/Tests/Open.Database.Extensions.Core.Tests/StallStreamTests.cs @@ -56,8 +56,8 @@ public static async Task Stream_DeliversEveryRow_InOrder_ThenEnds(bool finite) List ids = await Collect(Query(tally).Stream(finite ? Long : Timeout.InfiniteTimeSpan, Ct)); Assert.Equal(Enumerable.Range(1, 25), ids); - Assert.Single(tally.Readers); - Assert.Equal(1, tally.Readers[0].Disposes); + var reader = Assert.Single(tally.Readers); + Assert.Equal(1, reader.Disposes); Assert.Equal(ConnectionState.Closed, tally.Connections[0].State); } diff --git a/Tests/Open.Database.Extensions.Generator.Tests/Harness.cs b/Tests/Open.Database.Extensions.Generator.Tests/Harness.cs index 6b05a7c0..fbbd4ad2 100644 --- a/Tests/Open.Database.Extensions.Generator.Tests/Harness.cs +++ b/Tests/Open.Database.Extensions.Generator.Tests/Harness.cs @@ -5,7 +5,7 @@ using System.Reflection; // The counters are process-wide: one test at a time, so each test's deltas are its own. -[assembly: CollectionBehavior(DisableTestParallelization = true)] +[assembly: Xunit.v3.Parallelization(Mode = Xunit.Sdk.ParallelMode.None)] namespace Open.Database.Extensions.Generator.Tests; diff --git a/Tests/Open.Database.Extensions.Generator.Tests/Open.Database.Extensions.Generator.Tests.csproj b/Tests/Open.Database.Extensions.Generator.Tests/Open.Database.Extensions.Generator.Tests.csproj index ade4f890..de9817cf 100644 --- a/Tests/Open.Database.Extensions.Generator.Tests/Open.Database.Extensions.Generator.Tests.csproj +++ b/Tests/Open.Database.Extensions.Generator.Tests/Open.Database.Extensions.Generator.Tests.csproj @@ -25,17 +25,18 @@ - - - - - + + + + + + - - - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -44,9 +45,15 @@ - + + + + + + + diff --git a/Tests/Open.Database.Extensions.Generator.Tests/ParityTests.Partial.cs b/Tests/Open.Database.Extensions.Generator.Tests/ParityTests.Partial.cs index 01523d04..a9193ef6 100644 --- a/Tests/Open.Database.Extensions.Generator.Tests/ParityTests.Partial.cs +++ b/Tests/Open.Database.Extensions.Generator.Tests/ParityTests.Partial.cs @@ -5,6 +5,9 @@ namespace Open.Database.Extensions.Generator.Tests; // Partial models. Another source generator (here the MVVM toolkit's) adds members that the ODX generator cannot see; the built type is // checked once, and a model that differs is read by the runtime map, so no column is left unset. +// +// These models use the toolkit's field form on purpose (it is the form most existing code has), so MVVMTK0042, which asks for a partial property, is not followed. +#pragma warning disable MVVMTK0042 internal sealed partial class ToolkitPost : ObservableObject { diff --git a/Tests/Open.Database.Extensions.LegacyCompiler.Tests/Open.Database.Extensions.LegacyCompiler.Tests.csproj b/Tests/Open.Database.Extensions.LegacyCompiler.Tests/Open.Database.Extensions.LegacyCompiler.Tests.csproj index c96f5dfd..af463a13 100644 --- a/Tests/Open.Database.Extensions.LegacyCompiler.Tests/Open.Database.Extensions.LegacyCompiler.Tests.csproj +++ b/Tests/Open.Database.Extensions.LegacyCompiler.Tests/Open.Database.Extensions.LegacyCompiler.Tests.csproj @@ -33,9 +33,9 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Tests/Open.Database.Extensions.PackageConsumer.Tests/ConsumerTests.cs b/Tests/Open.Database.Extensions.PackageConsumer.Tests/ConsumerTests.cs index 2c1ff59d..fa5b9e4a 100644 --- a/Tests/Open.Database.Extensions.PackageConsumer.Tests/ConsumerTests.cs +++ b/Tests/Open.Database.Extensions.PackageConsumer.Tests/ConsumerTests.cs @@ -8,7 +8,7 @@ using Open.Database.Extensions.Generated; #endif -[assembly: CollectionBehavior(DisableTestParallelization = true)] +[assembly: Xunit.v3.Parallelization(Mode = Xunit.Sdk.ParallelMode.None)] namespace Open.Database.Extensions.PackageConsumer.Tests; diff --git a/Tests/Open.Database.Extensions.PackageConsumer.Tests/Open.Database.Extensions.PackageConsumer.Tests.csproj b/Tests/Open.Database.Extensions.PackageConsumer.Tests/Open.Database.Extensions.PackageConsumer.Tests.csproj index ae4024a7..c2440206 100644 --- a/Tests/Open.Database.Extensions.PackageConsumer.Tests/Open.Database.Extensions.PackageConsumer.Tests.csproj +++ b/Tests/Open.Database.Extensions.PackageConsumer.Tests/Open.Database.Extensions.PackageConsumer.Tests.csproj @@ -5,7 +5,7 @@ targets included. Not in the solution: it restores only after the packages are packed (the generator job in .github/workflows/tests.yml): dotnet pack Source/Core -c Release -o -p:VersionSuffix= -p:GeneratePackageOnBuild=false (and Source/MSSqlClient) - dotnet test Tests/Open.Database.Extensions.PackageConsumer.Tests -p:OdxFeed= -p:OdxPackageVersion=11.0.0- + dotnet test Tests/Open.Database.Extensions.PackageConsumer.Tests -p:OdxFeed= -p:OdxPackageVersion=- -p:OdxVia=MSSqlClient references that package alone, so Core and its generator arrive transitively. -p:OdxGenerateMaps=false switches the generator off. @@ -35,14 +35,16 @@ - - - - - - - - + + + + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/docsite/articles/release-notes.md b/docsite/articles/release-notes.md index 4c008b3d..e1e951ae 100644 --- a/docsite/articles/release-notes.md +++ b/docsite/articles/release-notes.md @@ -1,6 +1,39 @@ # Release notes -Version 11 is `11.0.0`. For moving a 10.x codebase, read [Coming from earlier versions](whats-new-11.md) first; this page lists each release. +Version 11 is `11.0.1`. For moving a 10.x codebase, read [Coming from earlier versions](whats-new-11.md) first; this page lists each release. + +## Version 11.0.1 + +A dependency update. The public API and what Core, Channel and Dataflow do are unchanged; the dependencies of the shipped packages are at the newest version that supports each target framework they are built for; the one exception, `netstandard2.1`, is explained below. + +### Dependencies of the packages + +| Package | Used by | 11.0.0 | 11.0.1 | +|---|---|---|---| +| `Microsoft.Data.SqlClient` | `MSSqlClient` (`net472`, `net10.0`, `net11.0`) | 7.1.1 | 8.0.0 | +| `System.Security.Cryptography.Pkcs` | `MSSqlClient` | 10.0.14 | 11.0.0 | +| `System.Linq.AsyncEnumerable`, `System.Threading.Channels`, `System.Collections.Immutable` | Core, on `netstandard2.0` and `netstandard2.1` | 10.0.14 | 11.0.0 on `netstandard2.0`; 10.0.15 on `netstandard2.1` | +| `Microsoft.Bcl.AsyncInterfaces` | Core, on `netstandard2.0` | 10.0.14 | 11.0.0 | +| `System.Threading.Tasks.Dataflow` | Dataflow | 10.0.14 | 11.0.0 on every target but `netstandard2.1`; 10.0.15 on `netstandard2.1` | + +`System.Memory` and `System.Threading.Tasks.Extensions` (Core, `netstandard2.0`) are at 4.6.3, their newest version. + +**Why `netstandard2.1` stays on 10.0.15.** .NET 8 and .NET 9 projects take the `netstandard2.1` build. The 11.0.0 `System.*` packages warn at build time for those projects ("doesn't support net8.0"), so that build takes the newest 10.0.x until .NET 8 and .NET 9 are out of support. Every other target takes 11.0.0. A reference is a minimum: a project of your own can resolve a higher version. + +**What a consumer sees.** + +- A .NET Framework project (it takes the `netstandard2.0` build) gets the 11.0.0 `System.*` packages, and `Microsoft.Bcl.AsyncInterfaces` 11.0.0. +- A project that references `MSSqlClient` gets `Microsoft.Data.SqlClient` 8.0.0. Read the SqlClient 8.0.0 release notes before you upgrade; the changes most likely to reach a program that uses this package are the minimum runtime and the connection defaults below. `net472` still works (SqlClient 8.0.0 ships a `net462` build), and so do `net10.0` and `net11.0`. +- SqlClient 8.0.0 needs .NET 10 or later on modern .NET. `MSSqlClient` targets `net472`, `net10.0` and `net11.0` (as in 11.0.0), so a .NET 8 or .NET 9 project could not use it before and cannot now. +- Connection defaults changed in SqlClient 8.0.0: `MultiSubnetFailover` is on by default, `UseOverallConnectTimeoutForPoolWait` is on by default (a connection that waits for the pool can time out sooner), and `TransparentNetworkIPResolution` is off by default on .NET Framework. Azure attestation moved to the `Microsoft.Data.SqlClient.Extensions.Azure` package, SQL Server 2005 and the Type System Version setting are gone, and `SqlParameterCollection.RemoveAt` throws another exception type for an index out of range. A SqlClient 8.0 build raises the warning `SQLCLIENT001` for a mixed set of SqlClient family package versions. + +### The source generator + +Core now ships the generator twice, built from the same sources: against Roslyn 4.14 in `analyzers/dotnet/roslyn4.14/cs` and against Roslyn 5.12 in `analyzers/dotnet/roslyn5.12/cs`. NuGet gives a project the highest folder its compiler supports, so a compiler that supports Roslyn 5.12 (the .NET 11 SDK) loads that build, an older SDK or Visual Studio loads the Roslyn 4.14 build, and a compiler older than Roslyn 4.14 loads neither, as before. Both builds come from the same sources, and the generator tests run against both. + +### Tools used to build and test + +Not shipped; the main ones. `Microsoft.SourceLink.GitHub` 11.0.100, `Microsoft.CodeAnalysis.PublicApiAnalyzers` 5.6.0, `Microsoft.CodeAnalysis.Analyzers` 5.12.0, `Microsoft.NET.Test.Sdk` 18.12.0, `xunit.v3` 4.0.4, `xunit.runner.visualstudio` 4.0.2, `coverlet.collector` 10.1.1, `Microsoft.Data.Sqlite` 11.0.0 (10.0.15 in the `net472` consumer test project, because 11.0.0 supports .NET 10 and later only), `Microsoft.CodeAnalysis.CSharp` 5.12.0 in `Core.Tests` (`Generator.Tests` uses 4.14.0, and 5.12.0 when it runs against the Roslyn 5.12 generator build), `CommunityToolkit.Mvvm` 8.4.2, `docfx` 2.82.0 (`.config/dotnet-tools.json`). The NuGet package versions of the repository are in `Directory.Packages.props`; a project states a `VersionOverride` where it needs another. With xunit.v3 4.x the tests run through Microsoft.Testing.Platform: `dotnet test --project ` (`global.json` selects the runner). ## Version 11.0.0 diff --git a/docsite/samples/Samples.csproj b/docsite/samples/Samples.csproj index d6e3f1f4..c6dcbb57 100644 --- a/docsite/samples/Samples.csproj +++ b/docsite/samples/Samples.csproj @@ -17,14 +17,14 @@ - - - - + + + + - - - + + + diff --git a/global.json b/global.json index 63851d5a..7850a469 100644 --- a/global.json +++ b/global.json @@ -2,5 +2,8 @@ "sdk": { "version": "11.0.100", "rollForward": "latestFeature" + }, + "test": { + "runner": "Microsoft.Testing.Platform" } }