dncuug / X.PagedList

Library for easily paging through any IEnumerable/IQueryable in ASP.NET
https://andrew.gubskiy.com/open-source
MIT License
899 stars 213 forks source link

Remove JetBrains.Annotations dependency or make it a private asset #239

Closed jrummell-elite closed 1 year ago

jrummell-elite commented 1 year ago

Is your feature request related to a problem? Please describe. I have Resharper and editorconfig code analysis settings that format and fix code when I run code cleanup or save a file in Visual Studio. Because Resharper detects the JetBrains.Annotations, it injects the attributes from this package when I don't want it to.

For example, instead of generating this for an argument null check:

public async Task UpdateAsync(Vehicle originalValue, Vehicle newValue)
{
    if (newValue == null)
    {
        throw new ArgumentNullException(nameof(newValue));
    }
}

It generates this with a [NotNull] attribute:

public async Task AddSpecPointsAsync(Vehicle originalValue, [NotNull] Vehicle newValue)
{
    if (newValue == null)
    {
        throw new ArgumentNullException(nameof(newValue));
    }
}

Describe the solution you'd like Change the JetBrains.Annotations package reference to use private assets so that it isn't added as a transient dependency in projects that consume X.PagedList. See https://learn.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files#controlling-dependency-assets

    <ItemGroup>
        <PackageReference Include="JetBrains.Annotations" Version="2022.3.1">
            <PrivateAssets>all</PrivateAssets>
        </PackageReference>
    </ItemGroup>

I'm happy to create a PR if this is a change you are interested in completing.

SX-GitHub commented 1 year ago

I'm glad it's taken care of. The dependency stopped me from switching to X.PagedList.