Generic AutoFixture test sources emit IL2091 during native publishing
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
The warnings come from the generic data-source attributes in tests/TUnit.TestProject/Attributes/AutoFixtureSourceGeneratorAttribute.cs, at lines 3 and 11. Start by reading those attributes and the DataSourceGeneratorAttribute base classes they derive from, to see which type parameters need the DynamicallyAccessedMembers(PublicConstructors) annotation. Reproduce with the dotnet publish -p:Aot=true command from the issue. Done means IL2091 no longer appears in the native publish output for these attributes.
Written by the indexing model from the issue text.
Description
Summary
Publishing the test application with Native AOT emits IL2091 warnings for the generic AutoFixture data-source attributes. Their type parameters do not carry the public-constructor annotations required by their DataSourceGeneratorAttribute base classes, making unrelated native validation noisy and potentially allowing fixture types to be trimmed incorrectly.
Reproduction
At commit 309ed46a59, run:
dotnet publish tests/TUnit.TestProject -c Release -f net10.0 -p:Aot=true --use-current-runtime
Expected and actual
The generic parameters in tests/TUnit.TestProject/Attributes/AutoFixtureSourceGeneratorAttribute.cs:3 and :11 should satisfy the base classes' trimming contracts. Instead, IL2091 reports missing DynamicallyAccessedMemberTypes.PublicConstructors on T and T1/T2/T3.
Environment
.NET SDK 10.0.403, .NET native compiler 10.0.14, macOS arm64.
Add the required annotations to these test fixture attributes and verify that these IL2091 warnings disappear during native publishing.
- Dominant language
- C#
- Stars
- 4k
- Forks
- 139
- Avg merge
- 9h 6m
- Merged PRs (30d)
- 282
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from thomhurst/TUnit
-
bug P3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
documentation P3
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
thomhurst/TUnit#7444 · 1 comment ·
Maintainers usually reply within 1 day
-
bug P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug P2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug P3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
Similar issues
-
is:build
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
nopSolutions/nopCommerce#8440 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
RadicalCSG/com.chisel#192 ·
Maintainers usually reply within 1 day
-
area-testing p2-post-1.0 technical-debt
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
RazorConsole/RazorConsole#447 ·
Maintainers usually reply within 1 day