ardalis / GuardClauses

A simple package with guard clause extensions.
MIT License
3.06k stars 270 forks source link

291 Added backwards compatibility #303

Closed Marvin-Brouwer closed 11 months ago

Marvin-Brouwer commented 1 year ago

Fixes #291.

To test this I referenced this project directly, in a multi target project, like so:

    <ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
        <Reference Include="Ardalis.GuardClauses">
            <HintPath>..\..\..\GuardClauses\src\GuardClauses\bin\Release\net7.0\Ardalis.GuardClauses.dll</HintPath>
        </Reference>
    </ItemGroup>
    <ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
        <Reference Include="Ardalis.GuardClauses">
            <HintPath>..\..\..\GuardClauses\src\GuardClauses\bin\Release\netstandard2.1\Ardalis.GuardClauses.dll</HintPath>
        </Reference>
    </ItemGroup>
    <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
        <Reference Include="Ardalis.GuardClauses">
            <HintPath>..\..\..\GuardClauses\src\GuardClauses\bin\Release\netstandard2.1\Ardalis.GuardClauses.dll</HintPath>
        </Reference>
    </ItemGroup>
    <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
        <Reference Include="Ardalis.GuardClauses">
            <HintPath>..\..\..\GuardClauses\src\GuardClauses\bin\Release\netstandard2.0\Ardalis.GuardClauses.dll</HintPath>
        </Reference>
    </ItemGroup>

I changed one of my unit-test that validated a Guard.Against.Null(...); into net6.0 and stepped into a test. It did automatically resolve the parameterName in Lang version 10.

Feel free to validate this locally before approving.

ardalis commented 1 year ago

Cool, thanks! I'll try to make time to try this out soon. Pretty overwhelmed at the moment.