diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index f88cbca..50ff8f0 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -8,7 +8,7 @@ on: - 'tests/**' - 'benchmarks/**' - 'tools/**' - - '*.sln' + - '*.slnx' - '*.props' - 'global.json' - '.github/workflows/build-and-test.yml' @@ -19,7 +19,7 @@ on: - 'tests/**' - 'benchmarks/**' - 'tools/**' - - '*.sln' + - '*.slnx' - '*.props' - 'global.json' - '.github/workflows/build-and-test.yml' @@ -34,10 +34,10 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + global-json-file: global.json - name: Restore dependencies - run: dotnet restore ./Light.GuardClauses.sln + run: dotnet restore ./Light.GuardClauses.slnx - name: Build - run: dotnet build ./Light.GuardClauses.sln -c Release --no-restore + run: dotnet build ./Light.GuardClauses.slnx -c Release --no-restore - name: Test - run: dotnet test ./Light.GuardClauses.sln -c Release --no-build --verbosity normal + run: dotnet test ./Light.GuardClauses.slnx -c Release --no-build --verbosity normal diff --git a/.github/workflows/release-on-nuget.yml b/.github/workflows/release-on-nuget.yml index 7b2166d..f159928 100644 --- a/.github/workflows/release-on-nuget.yml +++ b/.github/workflows/release-on-nuget.yml @@ -4,11 +4,6 @@ on: release: types: [published] workflow_dispatch: - inputs: - dotnetVersion: - description: "The version of .NET to use" - required: false - default: "8.0.x" jobs: release-to-nuget: @@ -20,7 +15,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: ${{ github.event.inputs.dotnetVersion || '8.0.x' }} + global-json-file: global.json - name: Prepare SNK file env: LIGHT_GUARDCLAUSES_SNK: ${{ secrets.LIGHT_GUARDCLAUSES_SNK }} diff --git a/Directory.Build.props b/Directory.Build.props index 6b55a77..c580c19 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ 14.0.0 - 12 + 14 Kenny Pflug Kenny Pflug Copyright © Kenny Pflug 2016, 2025 diff --git a/Directory.Packages.props b/Directory.Packages.props index 67ed0fc..314026b 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,32 +3,24 @@ true false + - - - - - + + + + + + - - + - - - - diff --git a/Light.GuardClauses.SingleFile.cs b/Light.GuardClauses.SingleFile.cs index e1f6d1a..192bbe6 100644 --- a/Light.GuardClauses.SingleFile.cs +++ b/Light.GuardClauses.SingleFile.cs @@ -5564,7 +5564,7 @@ public static T MustNotBeDefault([NotNull, ValidatedNotNull] this T parameter return parameter; } - if (EqualityComparer.Default.Equals(parameter, default !)) + if (EqualityComparer.Default.Equals(parameter, default!)) { Throw.ArgumentDefault(parameterName, message); } @@ -5595,7 +5595,7 @@ public static T MustNotBeDefault([NotNull, ValidatedNotNull] this T parameter return parameter; } - if (EqualityComparer.Default.Equals(parameter, default !)) + if (EqualityComparer.Default.Equals(parameter, default!)) { Throw.CustomException(exceptionFactory); } diff --git a/Light.GuardClauses.sln b/Light.GuardClauses.sln deleted file mode 100644 index e086c9d..0000000 --- a/Light.GuardClauses.sln +++ /dev/null @@ -1,111 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29102.190 -MinimumVisualStudioVersion = 15.0.26124.0 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Light.GuardClauses", "src\Light.GuardClauses\Light.GuardClauses.csproj", "{E850D655-B8C8-49B5-8336-D4743504B064}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Light.GuardClauses.Tests", "tests\Light.GuardClauses.Tests\Light.GuardClauses.Tests.csproj", "{E804A19A-589D-49CC-A649-3092013E0133}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Light.GuardClauses.Performance", "benchmarks\Light.GuardClauses.Performance\Light.GuardClauses.Performance.csproj", "{F4EE1A0F-60E0-4077-BFC4-82387535352A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Light.GuardClauses.InternalRoslynAnalyzers", "tools\analyzers\Light.GuardClauses.InternalRoslynAnalyzers\Light.GuardClauses.InternalRoslynAnalyzers.csproj", "{DB4A3982-5312-4923-9C79-C39D18A5899C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Light.GuardClauses.InternalRoslynAnalyzers.CodeFixes", "tools\analyzers\Light.GuardClauses.InternalRoslynAnalyzers.CodeFixes\Light.GuardClauses.InternalRoslynAnalyzers.CodeFixes.csproj", "{0D6B435A-E59C-48EB-A13D-69FDB5B6F4A1}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Light.GuardClauses.InternalRoslynAnalyzers.Tests", "tests\Light.GuardClauses.InternalRoslynAnalyzers.Tests\Light.GuardClauses.InternalRoslynAnalyzers.Tests.csproj", "{2FE2D52E-21B8-4C51-9983-9C1812BDEBA0}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Light.GuardClauses.SourceCodeTransformation", "tools\source-export\Light.GuardClauses.SourceCodeTransformation\Light.GuardClauses.SourceCodeTransformation.csproj", "{ECE42390-E3B5-49D4-9452-3B0CC04C633A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Light.GuardClauses.SourceValidation", "tools\source-export\Light.GuardClauses.SourceValidation\Light.GuardClauses.SourceValidation.csproj", "{B546B7B7-9CA5-456C-96CD-15C21E64B7DF}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Light.GuardClauses.SourceCodeTransformation.Tests", "tests\Light.GuardClauses.SourceCodeTransformation.Tests\Light.GuardClauses.SourceCodeTransformation.Tests.csproj", "{A2067796-F167-47BE-B367-191152DCE230}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{11B02CC1-06EC-4A20-8964-B7E941FAEB49}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{22B02CC1-06EC-4A20-8964-B7E941FAEB49}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks", "{33B02CC1-06EC-4A20-8964-B7E941FAEB49}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{44B02CC1-06EC-4A20-8964-B7E941FAEB49}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "analyzers", "analyzers", "{55B02CC1-06EC-4A20-8964-B7E941FAEB49}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "source-export", "source-export", "{66B02CC1-06EC-4A20-8964-B7E941FAEB49}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8A42A536-E597-454B-BE18-4F62311FA158}" - ProjectSection(SolutionItems) = preProject - .gitignore = .gitignore - AGENTS.md = AGENTS.md - CLAUDE.md = CLAUDE.md - CONTRIBUTING.md = CONTRIBUTING.md - Directory.Build.props = Directory.Build.props - Directory.Packages.props = Directory.Packages.props - global.json = global.json - LICENSE = LICENSE - Light.GuardClauses.sln.DotSettings = Light.GuardClauses.sln.DotSettings - README.md = README.md - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E850D655-B8C8-49B5-8336-D4743504B064}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E850D655-B8C8-49B5-8336-D4743504B064}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E850D655-B8C8-49B5-8336-D4743504B064}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E850D655-B8C8-49B5-8336-D4743504B064}.Release|Any CPU.Build.0 = Release|Any CPU - {E804A19A-589D-49CC-A649-3092013E0133}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E804A19A-589D-49CC-A649-3092013E0133}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E804A19A-589D-49CC-A649-3092013E0133}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E804A19A-589D-49CC-A649-3092013E0133}.Release|Any CPU.Build.0 = Release|Any CPU - {F4EE1A0F-60E0-4077-BFC4-82387535352A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F4EE1A0F-60E0-4077-BFC4-82387535352A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F4EE1A0F-60E0-4077-BFC4-82387535352A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F4EE1A0F-60E0-4077-BFC4-82387535352A}.Release|Any CPU.Build.0 = Release|Any CPU - {DB4A3982-5312-4923-9C79-C39D18A5899C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DB4A3982-5312-4923-9C79-C39D18A5899C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DB4A3982-5312-4923-9C79-C39D18A5899C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DB4A3982-5312-4923-9C79-C39D18A5899C}.Release|Any CPU.Build.0 = Release|Any CPU - {0D6B435A-E59C-48EB-A13D-69FDB5B6F4A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0D6B435A-E59C-48EB-A13D-69FDB5B6F4A1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0D6B435A-E59C-48EB-A13D-69FDB5B6F4A1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0D6B435A-E59C-48EB-A13D-69FDB5B6F4A1}.Release|Any CPU.Build.0 = Release|Any CPU - {2FE2D52E-21B8-4C51-9983-9C1812BDEBA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2FE2D52E-21B8-4C51-9983-9C1812BDEBA0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2FE2D52E-21B8-4C51-9983-9C1812BDEBA0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2FE2D52E-21B8-4C51-9983-9C1812BDEBA0}.Release|Any CPU.Build.0 = Release|Any CPU - {ECE42390-E3B5-49D4-9452-3B0CC04C633A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ECE42390-E3B5-49D4-9452-3B0CC04C633A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ECE42390-E3B5-49D4-9452-3B0CC04C633A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ECE42390-E3B5-49D4-9452-3B0CC04C633A}.Release|Any CPU.Build.0 = Release|Any CPU - {B546B7B7-9CA5-456C-96CD-15C21E64B7DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B546B7B7-9CA5-456C-96CD-15C21E64B7DF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B546B7B7-9CA5-456C-96CD-15C21E64B7DF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B546B7B7-9CA5-456C-96CD-15C21E64B7DF}.Release|Any CPU.Build.0 = Release|Any CPU - {A2067796-F167-47BE-B367-191152DCE230}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A2067796-F167-47BE-B367-191152DCE230}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A2067796-F167-47BE-B367-191152DCE230}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A2067796-F167-47BE-B367-191152DCE230}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {E850D655-B8C8-49B5-8336-D4743504B064} = {11B02CC1-06EC-4A20-8964-B7E941FAEB49} - {E804A19A-589D-49CC-A649-3092013E0133} = {22B02CC1-06EC-4A20-8964-B7E941FAEB49} - {2FE2D52E-21B8-4C51-9983-9C1812BDEBA0} = {22B02CC1-06EC-4A20-8964-B7E941FAEB49} - {A2067796-F167-47BE-B367-191152DCE230} = {22B02CC1-06EC-4A20-8964-B7E941FAEB49} - {F4EE1A0F-60E0-4077-BFC4-82387535352A} = {33B02CC1-06EC-4A20-8964-B7E941FAEB49} - {DB4A3982-5312-4923-9C79-C39D18A5899C} = {55B02CC1-06EC-4A20-8964-B7E941FAEB49} - {0D6B435A-E59C-48EB-A13D-69FDB5B6F4A1} = {55B02CC1-06EC-4A20-8964-B7E941FAEB49} - {ECE42390-E3B5-49D4-9452-3B0CC04C633A} = {66B02CC1-06EC-4A20-8964-B7E941FAEB49} - {B546B7B7-9CA5-456C-96CD-15C21E64B7DF} = {66B02CC1-06EC-4A20-8964-B7E941FAEB49} - {55B02CC1-06EC-4A20-8964-B7E941FAEB49} = {44B02CC1-06EC-4A20-8964-B7E941FAEB49} - {66B02CC1-06EC-4A20-8964-B7E941FAEB49} = {44B02CC1-06EC-4A20-8964-B7E941FAEB49} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {1566605B-18A9-423B-BB52-1406254EDE47} - EndGlobalSection -EndGlobal diff --git a/Light.GuardClauses.slnx b/Light.GuardClauses.slnx new file mode 100644 index 0000000..8f69c99 --- /dev/null +++ b/Light.GuardClauses.slnx @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index c0b21df..8bae146 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ Every assertion is well-documented - explore them using IntelliSense or check ou ## Light.GuardClauses is optimized -Since version 4, **Light.GuardClauses** is optimized for performance (measured in .NET 4.8 and .NET 8). With the incredible help of [@redknightlois](https://github.com/redknightlois) and the awesome tool [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet), most assertions are as fast as your imperative code would be. +Since version 4, **Light.GuardClauses** is optimized for performance (measured in .NET Framework 4.8 and .NET 10). With the incredible help of [@redknightlois](https://github.com/redknightlois) and the awesome tool [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet), most assertions are as fast as your imperative code would be. **Light.GuardClauses** has support for [.NET analyzers / FxCopAnalyzers](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview) with the `ValidatedNotNullAttribute` and the `NotNullAttribute`. Analyzers will know when an assertion validated that a parameters is not null and consequently, CA1062 will not be raised. @@ -109,8 +109,8 @@ And, of course, the functional correctness of **Light.GuardClauses** is covered ## Supported Platforms **Light.GuardClauses** is built -against [.NET 8, .NET Standard 2.0 and 2.1](https://docs.microsoft.com/en-us/dotnet/standard/net-standard), thus it can -be used with a large variety of target frameworks like .NET 5 or newer .NET Framework 4.6.1 or newer, Unity, Mono, or +against [.NET 10, .NET Standard 2.0 and 2.1](https://learn.microsoft.com/dotnet/standard/net-standard), thus it can +be used with a large variety of target frameworks like .NET 5 or newer, .NET Framework 4.6.1 or newer, Unity, Mono, or UWP. ## How to Install diff --git a/ai-plans/0141-net-10-upgrade.md b/ai-plans/0141-net-10-upgrade.md new file mode 100644 index 0000000..2ddb785 --- /dev/null +++ b/ai-plans/0141-net-10-upgrade.md @@ -0,0 +1,41 @@ +# Upgrade the Repository to .NET 10 + +## Rationale + +The repository is pinned to the .NET 8 SDK and C# 12, its runnable projects and automation use .NET 8, and the source-export pipeline models .NET 8 as its modern target. Upgrade the development and execution baseline to the .NET 10 LTS toolchain, replace the `net8.0` product asset with `net10.0`, and retain the existing .NET Standard compatibility floor. + +The upgrade must also keep the compiler-loaded analyzer safe after the RS1038 assembly split, align Roslyn with the pinned SDK, and accommodate .NET 10 package pruning without suppressing warnings or changing guard-clause behavior. + +## Acceptance Criteria + +- [x] `global.json` selects the .NET SDK 10.0.300 feature band with `latestPatch`, and local builds, CI, and release packaging use that SDK selection as their single source of truth. +- [x] The repository uses C# 14; runnable tools and test projects target `net10.0`, benchmarks target `net10.0` and `net48`, and the product package contains exactly `netstandard2.0`, `netstandard2.1`, and `net10.0` assets with no `net8.0` asset. +- [x] The `net10.0` product asset is Native AOT-compatible and exposes the existing modern API surface without behavioral or source-level regressions, including the span, memory, and generic-math overloads. +- [x] The analyzer, code-fix, and source-export projects use Roslyn 5.6.0 consistently; Release builds produce no RS1038, CS8032, or new Roslyn analyzer warnings, and analyzer and code-fix behavior remains covered by automated tests. +- [x] Source export replaces `Net8_0` with `Net10_0`, emits and validates the correct .NET 10 source, and preserves `NetStandard2_0` as the default for the committed single-file distribution. +- [x] Restore and build produce no NU1510 package-pruning warning, and the packed NuGet dependency groups contain only dependencies required by each target framework. +- [x] User-facing framework documentation describes the resulting .NET 10 and .NET Standard support accurately and contains no stale .NET 8 SDK, target-framework, or support claims. +- [x] The complete solution restores and builds without warnings in Release configuration on the pinned SDK, all automated tests pass, and a signed-equivalent package verification confirms the expected assemblies, symbols, Source Link data, documentation, icon, and target-framework dependency groups. + +## Technical Details + +Use this target matrix: + +| Component | Target frameworks | +| --- | --- | +| `Light.GuardClauses` | `netstandard2.0;netstandard2.1;net10.0` | +| Main, analyzer, and source-export test projects | `net10.0` by default | +| Source-export tool | `net10.0` | +| Source-validation harness | `netstandard2.0;net10.0` | +| Benchmarks | `net10.0;net48` | +| Analyzer and code-fix assemblies | `netstandard2.0` | + +Retain the main test project's optional `TargetFrameworks.props` override and enable `IsAotCompatible` for the `net10.0` product asset. Existing `NET8_0_OR_GREATER` branches express the API capability boundary and are defined when targeting .NET 10; retain them rather than performing a mechanical rename to .NET 10 guards. Compile the repository with an explicit `14`. C# 14 changes overload resolution involving `Span` conversions, so the existing string, span, memory, and generic-math tests must compile and pass without changing the public overload set unless a genuine ambiguity is found. + +Pin `Microsoft.CodeAnalysis.Analyzers`, `Microsoft.CodeAnalysis.CSharp`, and `Microsoft.CodeAnalysis.CSharp.Workspaces` to 5.6.0, matching the compiler line in the .NET SDK 10.0.300 feature band. Remove the code-fix project's 4.11.0 `VersionOverride` and update the central explanatory comment, while preserving the compiler-only dependency boundary of `Light.GuardClauses.InternalRoslynAnalyzers` and the Workspaces dependency in `Light.GuardClauses.InternalRoslynAnalyzers.CodeFixes`. The source-export tool and its tests use the same Workspaces version, so syntax parsing, semantic analysis, analyzers, and code fixes all share one Roslyn line. + +Account for .NET 10's framework-package pruning rather than disabling it. `System.Collections.Immutable` remains a package dependency only where it is required for the .NET Standard product and validation assets; `net10.0` uses the framework assembly, and the source-export tool does not carry a redundant direct reference. Update the centrally managed `Microsoft.Extensions.Configuration.*` and `System.Collections.Immutable` packages to 10.0.9. Remove the explicit `Microsoft.SourceLink.GitHub` package because Source Link for GitHub is included and enabled by the .NET 10 SDK; retain the existing repository, symbol-package, and untracked-source properties and verify their packed output. + +Replace `SourceTargetFramework.Net8_0` with `Net10_0`. The parse-options factory uses C# 14 and defines the symbols required by the current source to select its .NET 10 branches: `NET`, `NETCOREAPP`, `NET10_0`, `NET10_0_OR_GREATER`, `NET9_0_OR_GREATER`, and `NET8_0_OR_GREATER`, but not the exact-version symbol `NET8_0`. Update modern-only imports, polyfill suppression, the validation project, validator mapping, configuration, and tests for the replacement target. Cover .NET 10 flattening, conditional branch selection, polyfill omission, and build validation. The committed configuration and `Light.GuardClauses.SingleFile.cs` remain the portable `NetStandard2_0` output. + +Update both GitHub Actions workflows to install the SDK through `global-json-file: global.json`. Remove the release workflow's independently configurable SDK-version input so an older compiler cannot load analyzers built against Roslyn 5.6.0. Preserve the existing restore/build/test and signed package flow otherwise. diff --git a/benchmarks/Light.GuardClauses.Performance/Light.GuardClauses.Performance.csproj b/benchmarks/Light.GuardClauses.Performance/Light.GuardClauses.Performance.csproj index 3031126..fca75f5 100644 --- a/benchmarks/Light.GuardClauses.Performance/Light.GuardClauses.Performance.csproj +++ b/benchmarks/Light.GuardClauses.Performance/Light.GuardClauses.Performance.csproj @@ -2,7 +2,7 @@ Exe - net8.0;net48 + net10.0;net48 diff --git a/global.json b/global.json index db09cbb..50baaf1 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.400", + "version": "10.0.300", "rollForward": "latestPatch" } } diff --git a/src/Directory.Build.props b/src/Directory.Build.props index aa3403d..5ff4371 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -24,10 +24,6 @@ - - - - diff --git a/src/Light.GuardClauses/Light.GuardClauses.csproj b/src/Light.GuardClauses/Light.GuardClauses.csproj index f31694b..d519dc6 100644 --- a/src/Light.GuardClauses/Light.GuardClauses.csproj +++ b/src/Light.GuardClauses/Light.GuardClauses.csproj @@ -1,15 +1,15 @@ - netstandard2.0;netstandard2.1;net8.0 + netstandard2.0;netstandard2.1;net10.0 enable - true + true true - + diff --git a/tests/Light.GuardClauses.InternalRoslynAnalyzers.Tests/Light.GuardClauses.InternalRoslynAnalyzers.Tests.csproj b/tests/Light.GuardClauses.InternalRoslynAnalyzers.Tests/Light.GuardClauses.InternalRoslynAnalyzers.Tests.csproj index c0c478d..ac766a1 100644 --- a/tests/Light.GuardClauses.InternalRoslynAnalyzers.Tests/Light.GuardClauses.InternalRoslynAnalyzers.Tests.csproj +++ b/tests/Light.GuardClauses.InternalRoslynAnalyzers.Tests/Light.GuardClauses.InternalRoslynAnalyzers.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 diff --git a/tests/Light.GuardClauses.SourceCodeTransformation.Tests/GeneratedFileBuildValidatorTests.cs b/tests/Light.GuardClauses.SourceCodeTransformation.Tests/GeneratedFileBuildValidatorTests.cs index c1399fe..7ba4378 100644 --- a/tests/Light.GuardClauses.SourceCodeTransformation.Tests/GeneratedFileBuildValidatorTests.cs +++ b/tests/Light.GuardClauses.SourceCodeTransformation.Tests/GeneratedFileBuildValidatorTests.cs @@ -47,18 +47,18 @@ public static void ValidateReturnsNonZeroExitCodeAndLeavesFileOnBuildFailure() var targetFile = Path.Combine(temporaryDirectory.DirectoryPath, "Generated.cs"); File.WriteAllText(targetFile, "namespace ValidationSample; public static class Generated { this is invalid }"); - GeneratedFileBuildValidator.Validate(SourceTargetFramework.Net8_0, targetFile).Should().NotBe(0); + GeneratedFileBuildValidator.Validate(SourceTargetFramework.Net10_0, targetFile).Should().NotBe(0); File.Exists(targetFile).Should().BeTrue(); } [Fact] - public static void ValidateReturnsZeroForCompilingFileOnNet8() + public static void ValidateReturnsZeroForCompilingFileOnNet10() { using var temporaryDirectory = new TemporaryDirectory(); var targetFile = Path.Combine(temporaryDirectory.DirectoryPath, "Generated.cs"); File.WriteAllText(targetFile, "namespace ValidationSample; public static class Generated { }"); - GeneratedFileBuildValidator.Validate(SourceTargetFramework.Net8_0, targetFile).Should().Be(0); + GeneratedFileBuildValidator.Validate(SourceTargetFramework.Net10_0, targetFile).Should().Be(0); } [Fact] diff --git a/tests/Light.GuardClauses.SourceCodeTransformation.Tests/Light.GuardClauses.SourceCodeTransformation.Tests.csproj b/tests/Light.GuardClauses.SourceCodeTransformation.Tests/Light.GuardClauses.SourceCodeTransformation.Tests.csproj index 53dca0e..7c9f0ab 100644 --- a/tests/Light.GuardClauses.SourceCodeTransformation.Tests/Light.GuardClauses.SourceCodeTransformation.Tests.csproj +++ b/tests/Light.GuardClauses.SourceCodeTransformation.Tests/Light.GuardClauses.SourceCodeTransformation.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 diff --git a/tests/Light.GuardClauses.SourceCodeTransformation.Tests/SourceFileMergerFrameworkTests.cs b/tests/Light.GuardClauses.SourceCodeTransformation.Tests/SourceFileMergerFrameworkTests.cs index 805667a..0575675 100644 --- a/tests/Light.GuardClauses.SourceCodeTransformation.Tests/SourceFileMergerFrameworkTests.cs +++ b/tests/Light.GuardClauses.SourceCodeTransformation.Tests/SourceFileMergerFrameworkTests.cs @@ -8,12 +8,12 @@ namespace Light.GuardClauses.SourceCodeTransformation.Tests; public static class SourceFileMergerFrameworkTests { [Fact] - public static void Net8ExportContainsNet8MembersAndNoDirectives() + public static void Net10ExportContainsModernMembersAndNoDirectives() { using var temporaryDirectory = new TemporaryDirectory(); - var targetFile = Path.Combine(temporaryDirectory.DirectoryPath, "Net8Export.cs"); + var targetFile = Path.Combine(temporaryDirectory.DirectoryPath, "Net10Export.cs"); - SourceFileMerger.CreateSingleSourceFile(CreateOptions(targetFile, SourceTargetFramework.Net8_0)); + SourceFileMerger.CreateSingleSourceFile(CreateOptions(targetFile, SourceTargetFramework.Net10_0)); var sourceCode = File.ReadAllText(targetFile); sourceCode.Should().Contain("using System.Numerics;"); @@ -26,7 +26,7 @@ public static void Net8ExportContainsNet8MembersAndNoDirectives() } [Fact] - public static void NetStandardExportOmitsNet8MembersAndNoDirectives() + public static void NetStandardExportOmitsModernMembersAndNoDirectives() { using var temporaryDirectory = new TemporaryDirectory(); var targetFile = Path.Combine(temporaryDirectory.DirectoryPath, "NetStandardExport.cs"); @@ -43,12 +43,12 @@ public static void NetStandardExportOmitsNet8MembersAndNoDirectives() } [Fact] - public static void Net8ExportOmitsPolyfillAttributes() + public static void Net10ExportOmitsPolyfillAttributes() { using var temporaryDirectory = new TemporaryDirectory(); - var targetFile = Path.Combine(temporaryDirectory.DirectoryPath, "Net8Polyfill.cs"); + var targetFile = Path.Combine(temporaryDirectory.DirectoryPath, "Net10Polyfill.cs"); - SourceFileMerger.CreateSingleSourceFile(CreateOptions(targetFile, SourceTargetFramework.Net8_0)); + SourceFileMerger.CreateSingleSourceFile(CreateOptions(targetFile, SourceTargetFramework.Net10_0)); var sourceCode = File.ReadAllText(targetFile); sourceCode.Should().NotContain("class AllowNullAttribute"); @@ -69,14 +69,14 @@ public static void NetStandardExportIncludesPolyfillAttributes() } [Fact] - public static void Net8ExportValidatesAgainstNet8() + public static void Net10ExportValidatesAgainstNet10() { using var temporaryDirectory = new TemporaryDirectory(); - var targetFile = Path.Combine(temporaryDirectory.DirectoryPath, "Net8Validation.cs"); + var targetFile = Path.Combine(temporaryDirectory.DirectoryPath, "Net10Validation.cs"); - SourceFileMerger.CreateSingleSourceFile(CreateOptions(targetFile, SourceTargetFramework.Net8_0)); + SourceFileMerger.CreateSingleSourceFile(CreateOptions(targetFile, SourceTargetFramework.Net10_0)); - GeneratedFileBuildValidator.Validate(SourceTargetFramework.Net8_0, targetFile).Should().Be(0); + GeneratedFileBuildValidator.Validate(SourceTargetFramework.Net10_0, targetFile).Should().Be(0); } [Fact] diff --git a/tests/Light.GuardClauses.SourceCodeTransformation.Tests/TestEnvironment.cs b/tests/Light.GuardClauses.SourceCodeTransformation.Tests/TestEnvironment.cs index d15e03b..d6c0adb 100644 --- a/tests/Light.GuardClauses.SourceCodeTransformation.Tests/TestEnvironment.cs +++ b/tests/Light.GuardClauses.SourceCodeTransformation.Tests/TestEnvironment.cs @@ -5,7 +5,7 @@ namespace Light.GuardClauses.SourceCodeTransformation.Tests; internal static class TestEnvironment { - private const string RepositoryMarkerFileName = "Light.GuardClauses.sln"; + private const string RepositoryMarkerFileName = "Light.GuardClauses.slnx"; public static DirectoryInfo RepositoryRoot { get; } = FindRepositoryRoot(); diff --git a/tests/Light.GuardClauses.Tests/Light.GuardClauses.Tests.csproj b/tests/Light.GuardClauses.Tests/Light.GuardClauses.Tests.csproj index 7f9b667..2fc7420 100644 --- a/tests/Light.GuardClauses.Tests/Light.GuardClauses.Tests.csproj +++ b/tests/Light.GuardClauses.Tests/Light.GuardClauses.Tests.csproj @@ -3,7 +3,7 @@ - net8.0 + net10.0 true diff --git a/tools/analyzers/Light.GuardClauses.InternalRoslynAnalyzers.CodeFixes/Light.GuardClauses.InternalRoslynAnalyzers.CodeFixes.csproj b/tools/analyzers/Light.GuardClauses.InternalRoslynAnalyzers.CodeFixes/Light.GuardClauses.InternalRoslynAnalyzers.CodeFixes.csproj index aee134d..4e0fb4b 100644 --- a/tools/analyzers/Light.GuardClauses.InternalRoslynAnalyzers.CodeFixes/Light.GuardClauses.InternalRoslynAnalyzers.CodeFixes.csproj +++ b/tools/analyzers/Light.GuardClauses.InternalRoslynAnalyzers.CodeFixes/Light.GuardClauses.InternalRoslynAnalyzers.CodeFixes.csproj @@ -6,7 +6,7 @@ - + diff --git a/tools/source-export/Light.GuardClauses.SourceCodeTransformation/GeneratedFileBuildValidator.cs b/tools/source-export/Light.GuardClauses.SourceCodeTransformation/GeneratedFileBuildValidator.cs index c452e40..771e061 100644 --- a/tools/source-export/Light.GuardClauses.SourceCodeTransformation/GeneratedFileBuildValidator.cs +++ b/tools/source-export/Light.GuardClauses.SourceCodeTransformation/GeneratedFileBuildValidator.cs @@ -63,7 +63,7 @@ public static int Validate(SourceTargetFramework targetFramework, string targetF private static string MapToTargetFrameworkMoniker(SourceTargetFramework targetFramework) => targetFramework switch { - SourceTargetFramework.Net8_0 => "net8.0", + SourceTargetFramework.Net10_0 => "net10.0", _ => "netstandard2.0", }; diff --git a/tools/source-export/Light.GuardClauses.SourceCodeTransformation/Light.GuardClauses.SourceCodeTransformation.csproj b/tools/source-export/Light.GuardClauses.SourceCodeTransformation/Light.GuardClauses.SourceCodeTransformation.csproj index 79b0365..0b9aba6 100644 --- a/tools/source-export/Light.GuardClauses.SourceCodeTransformation/Light.GuardClauses.SourceCodeTransformation.csproj +++ b/tools/source-export/Light.GuardClauses.SourceCodeTransformation/Light.GuardClauses.SourceCodeTransformation.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net10.0 enable @@ -12,7 +12,6 @@ - diff --git a/tools/source-export/Light.GuardClauses.SourceCodeTransformation/RepositoryLayout.cs b/tools/source-export/Light.GuardClauses.SourceCodeTransformation/RepositoryLayout.cs index cb295d7..1490dd5 100644 --- a/tools/source-export/Light.GuardClauses.SourceCodeTransformation/RepositoryLayout.cs +++ b/tools/source-export/Light.GuardClauses.SourceCodeTransformation/RepositoryLayout.cs @@ -6,7 +6,7 @@ namespace Light.GuardClauses.SourceCodeTransformation; internal static class RepositoryLayout { - private const string RepositoryMarkerFileName = "Light.GuardClauses.sln"; + private const string RepositoryMarkerFileName = "Light.GuardClauses.slnx"; public static DirectoryInfo? TryFindRepositoryRoot(IEnumerable searchRoots) { diff --git a/tools/source-export/Light.GuardClauses.SourceCodeTransformation/SourceFileMerger.cs b/tools/source-export/Light.GuardClauses.SourceCodeTransformation/SourceFileMerger.cs index 3499071..f474e54 100644 --- a/tools/source-export/Light.GuardClauses.SourceCodeTransformation/SourceFileMerger.cs +++ b/tools/source-export/Light.GuardClauses.SourceCodeTransformation/SourceFileMerger.cs @@ -71,7 +71,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -{(options.TargetFramework == SourceTargetFramework.Net8_0 ? "using System.Numerics;" + Environment.NewLine : string.Empty)}{(options.IncludeJetBrainsAnnotationsUsing ? "using JetBrains.Annotations;" + Environment.NewLine : string.Empty)}using {options.BaseNamespace}.Exceptions; +{(options.TargetFramework == SourceTargetFramework.Net10_0 ? "using System.Numerics;" + Environment.NewLine : string.Empty)}{(options.IncludeJetBrainsAnnotationsUsing ? "using JetBrains.Annotations;" + Environment.NewLine : string.Empty)}using {options.BaseNamespace}.Exceptions; using {options.BaseNamespace}.ExceptionFactory; using {options.BaseNamespace}.FrameworkExtensions; {(options.IncludeJetBrainsAnnotationsUsing ? "using NotNullAttribute = System.Diagnostics.CodeAnalysis.NotNullAttribute;" : "")} diff --git a/tools/source-export/Light.GuardClauses.SourceCodeTransformation/SourceReachabilityAnalyzer.cs b/tools/source-export/Light.GuardClauses.SourceCodeTransformation/SourceReachabilityAnalyzer.cs index 0dd14c2..93500d7 100644 --- a/tools/source-export/Light.GuardClauses.SourceCodeTransformation/SourceReachabilityAnalyzer.cs +++ b/tools/source-export/Light.GuardClauses.SourceCodeTransformation/SourceReachabilityAnalyzer.cs @@ -13,9 +13,17 @@ internal static class SourceReachabilityAnalyzer { public static CSharpParseOptions CreateParseOptions(SourceTargetFramework targetFramework) => new ( - LanguageVersion.CSharp12, - preprocessorSymbols: targetFramework == SourceTargetFramework.Net8_0 - ? ["NET8_0_OR_GREATER", "NET8_0", "NETCOREAPP"] + LanguageVersion.CSharp14, + preprocessorSymbols: targetFramework == SourceTargetFramework.Net10_0 + ? + [ + "NET", + "NETCOREAPP", + "NET10_0", + "NET10_0_OR_GREATER", + "NET9_0_OR_GREATER", + "NET8_0_OR_GREATER", + ] : ["NETSTANDARD", "NETSTANDARD2_0"] ); diff --git a/tools/source-export/Light.GuardClauses.SourceCodeTransformation/SourceTargetFramework.cs b/tools/source-export/Light.GuardClauses.SourceCodeTransformation/SourceTargetFramework.cs index 9ec157c..df73161 100644 --- a/tools/source-export/Light.GuardClauses.SourceCodeTransformation/SourceTargetFramework.cs +++ b/tools/source-export/Light.GuardClauses.SourceCodeTransformation/SourceTargetFramework.cs @@ -3,5 +3,5 @@ namespace Light.GuardClauses.SourceCodeTransformation; public enum SourceTargetFramework { NetStandard2_0, - Net8_0, + Net10_0, } diff --git a/tools/source-export/Light.GuardClauses.SourceValidation/Light.GuardClauses.SourceValidation.csproj b/tools/source-export/Light.GuardClauses.SourceValidation/Light.GuardClauses.SourceValidation.csproj index d139a42..4b1a202 100644 --- a/tools/source-export/Light.GuardClauses.SourceValidation/Light.GuardClauses.SourceValidation.csproj +++ b/tools/source-export/Light.GuardClauses.SourceValidation/Light.GuardClauses.SourceValidation.csproj @@ -1,14 +1,14 @@ - netstandard2.0;net8.0 + netstandard2.0;net10.0 false true disable - +