Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- 'tests/**'
- 'benchmarks/**'
- 'tools/**'
- '*.sln'
- '*.slnx'
- '*.props'
- 'global.json'
- '.github/workflows/build-and-test.yml'
Expand All @@ -19,7 +19,7 @@ on:
- 'tests/**'
- 'benchmarks/**'
- 'tools/**'
- '*.sln'
- '*.slnx'
- '*.props'
- 'global.json'
- '.github/workflows/build-and-test.yml'
Expand All @@ -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
Comment thread
feO2x marked this conversation as resolved.
7 changes: 1 addition & 6 deletions .github/workflows/release-on-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<Version>14.0.0</Version>
<LangVersion>12</LangVersion>
<LangVersion>14</LangVersion>
<Authors>Kenny Pflug</Authors>
<Company>Kenny Pflug</Company>
<Copyright>Copyright © Kenny Pflug 2016, 2025</Copyright>
Expand Down
32 changes: 12 additions & 20 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,24 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<!--
Roslyn packages are pinned to match the compiler shipped with the SDK selected in global.json.
Light.GuardClauses.InternalRoslynAnalyzers is compiler-loaded and must not reference a newer Microsoft.CodeAnalysis than the SDK compiler.
Keep Microsoft.CodeAnalysis.* aligned so analyzers, code fixes, and source-export tooling use one Roslyn line.
-->
<ItemGroup>
Comment thread
Copilot marked this conversation as resolved.
<PackageVersion Include="BenchmarkDotNet" Version="0.15.6" />
<PackageVersion Include="FluentAssertions" Version="[7.2.0]" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.13.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.CommandLine" Version="10.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="10.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="5.6.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.6.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="5.6.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Configuration.CommandLine" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="10.0.9" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Nullable" Version="1.3.1" />
<PackageVersion Include="System.Collections.Immutable" Version="10.0.0" />
<PackageVersion Include="System.Collections.Immutable" Version="10.0.9" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
</ItemGroup>
<!--
The compiler-loaded analyzer assembly (Light.GuardClauses.InternalRoslynAnalyzers) and its
matching CodeFixes assembly must be built against Roslyn 4.11.0 to match the Roslyn version
shipped with the pinned .NET SDK 8.0.400 (see global.json). A compiler-loaded extension must
not reference a newer Microsoft.CodeAnalysis than the SDK's compiler. The analyzer is the only
consumer of Microsoft.CodeAnalysis.CSharp, so it is pinned centrally here. The CodeFixes project
overrides Microsoft.CodeAnalysis.CSharp.Workspaces to 4.11.0 via VersionOverride so its Roslyn
version matches the analyzer; the central Workspaces version stays 4.13.0 for the source-export
tooling, which runs on the installed SDK and is not a compiler extension.
-->
<ItemGroup>
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions Light.GuardClauses.SingleFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5564,7 +5564,7 @@ public static T MustNotBeDefault<T>([NotNull, ValidatedNotNull] this T parameter
return parameter;
}

if (EqualityComparer<T>.Default.Equals(parameter, default !))
if (EqualityComparer<T>.Default.Equals(parameter, default!))
{
Throw.ArgumentDefault(parameterName, message);
}
Expand Down Expand Up @@ -5595,7 +5595,7 @@ public static T MustNotBeDefault<T>([NotNull, ValidatedNotNull] this T parameter
return parameter;
}

if (EqualityComparer<T>.Default.Equals(parameter, default !))
if (EqualityComparer<T>.Default.Equals(parameter, default!))
{
Throw.CustomException(exceptionFactory);
}
Expand Down
111 changes: 0 additions & 111 deletions Light.GuardClauses.sln

This file was deleted.

34 changes: 34 additions & 0 deletions Light.GuardClauses.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<Solution>
<Folder Name="/benchmarks/">
<Project Path="benchmarks/Light.GuardClauses.Performance/Light.GuardClauses.Performance.csproj" />
</Folder>
<Folder Name="/Solution Items/">
<File Path=".gitignore" />
<File Path="AGENTS.md" />
<File Path="CLAUDE.md" />
<File Path="CONTRIBUTING.md" />
<File Path="Directory.Build.props" />
<File Path="Directory.Packages.props" />
<File Path="global.json" />
<File Path="LICENSE" />
<File Path="Light.GuardClauses.sln.DotSettings" />
<File Path="README.md" />
</Folder>
<Folder Name="/src/">
<Project Path="src/Light.GuardClauses/Light.GuardClauses.csproj" />
</Folder>
<Folder Name="/tests/">
<Project Path="tests/Light.GuardClauses.InternalRoslynAnalyzers.Tests/Light.GuardClauses.InternalRoslynAnalyzers.Tests.csproj" />
<Project Path="tests/Light.GuardClauses.SourceCodeTransformation.Tests/Light.GuardClauses.SourceCodeTransformation.Tests.csproj" />
<Project Path="tests/Light.GuardClauses.Tests/Light.GuardClauses.Tests.csproj" />
</Folder>
<Folder Name="/tools/" />
<Folder Name="/tools/analyzers/">
<Project Path="tools/analyzers/Light.GuardClauses.InternalRoslynAnalyzers.CodeFixes/Light.GuardClauses.InternalRoslynAnalyzers.CodeFixes.csproj" />
<Project Path="tools/analyzers/Light.GuardClauses.InternalRoslynAnalyzers/Light.GuardClauses.InternalRoslynAnalyzers.csproj" />
</Folder>
<Folder Name="/tools/source-export/">
<Project Path="tools/source-export/Light.GuardClauses.SourceCodeTransformation/Light.GuardClauses.SourceCodeTransformation.csproj" />
<Project Path="tools/source-export/Light.GuardClauses.SourceValidation/Light.GuardClauses.SourceValidation.csproj" />
</Folder>
</Solution>
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
Expand Down
Loading
Loading