mrahhal / MR.EntityFrameworkCore.KeysetPagination

Keyset/Seek/Cursor pagination for Entity Framework Core.
MIT License
236 stars 12 forks source link

Extremely slow builds likely due to non-private Microsoft.CodeAnalysis dependency in analyzer #59

Open Jameak opened 2 days ago

Jameak commented 2 days ago

After adding a package reference to MR.EntityFrameworkCore.KeysetPagination, the build times of my solution went from taking 1-2 minutes to around 50 minutes. I think I've narrowed down the reason to be caused by the MR.EntityFrameworkCore.KeysetPagination.Analyzers package having a dependency on Microsoft.CodeAnalysis.CSharp.Workspaces that is marked as non-private.

This causes my solution to get a transitive reference to Microsoft.CodeAnalysis.CSharp.Workspaces, which then seems to trigger this roslyn analyzer issue: https://github.com/dotnet/roslyn-analyzers/issues/6676

By overwriting the transitive Microsoft.CodeAnalysis.Analyzers reference from v3.3.4 to v3.11.0 via central package management the issue goes away.

I've looked at the csproj files of some other analyzers while debugging this issue, and they all seem to mark their Microsoft.CodeAnalysis.* dependencies as PrivateAssets="all". If you make that change, then this issue probably wont hit any other users of this package.

mrahhal commented 2 days ago

Thanks for reporting this. I will update the analyzer package's dependencies. Microsoft.CodeAnalysis.CSharp.Workspaces can't be marked with PrivateAssets="all" as I get errors otherwise. Not sure how other packages are using it.

Regardless, depending on Microsoft.CodeAnalysis.CSharp.Workspaces itself is also an issue, and should be replaced with Microsoft.CodeAnalysis.CSharp. Hopefully this will resolve the issue.