DapperLib / DapperLib/DapperAOT

Prevent analyzer for transitive dependencies

Open
#170 1 comment 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
472
Forks
43
Avg merge
1d 4h
Merged PRs (30d)
18

Description

Describe the bug

When adding Dapper.Aot on a project A, all project referencing project A will have the Dapper.aot analyzer enable and trigger the DAP001 on them.

I tried to play with PrivateAssets attribute of PackageReference but does not seem to work. Using PrivateAssets.All fail at runtime because the generated code use method defined in Dapper.Aot.dll

Where are you seeing this?

  • Dapper.Aot 1.0.48

To Reproduce
See screenshot

Expected behavior
Have a way to not leak roslyn analyzer as transitive dependency.
I want to use the source generator in my lib. But not in other app that use my nuget package

Screenshots

Image

Additional context
Dapper.Aot have been added to Hangfire.Postgres lib. But some people can use it as it enable Dapper.Aot in their app when referencing HF.PG nuget package

https://github.com/hangfire-postgres/Hangfire.PostgreSql/issues/416

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Dapper.Aot 1.0.48 behavior with a project A and a referencing project, focusing on the PackageReference and PrivateAssets settings. Check how the analyzer and generated code are packaged, and verify that the analyzer no longer reaches transitive consumers while Dapper.Aot.dll remains available at runtime.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.