feat: add `DynamicallyAccessedMembers` attribute by TimothyMakkison · Pull Request #1973 · reactiveui/refit
Conversation
Start to suppress AOT warnings
- Add a NET Standard 2.0 version of
DynamicallyAccessedMembersto make it easier to decorate functions
Looking at the 24 warnings when I build with AOT:
- The first are related to constructing the source generated types, these could be solved by emitting the logic to create the types. I'm not sure how this would neatly fit into the existing library without emitting
Refit.For<T>()code - A lot of errors are related to
MakeGenericType- form my understanding this is safe to use as long as the generated type is statically reachable. I believe this will always be true for refit so we can suppress this. Otherwise I could use some of my logic from feat: add aot sandbox #1969 to make remove warning. - Code related to
RefitSettingsinterfaces, this might be an issue. - Query serialisation will need the user to annotate
DynamicallyAccessedMembersfor members that will be serialised, although refit could emit this when needed. (This has some issues) - Warnings around json serialisation. The user can configure a
JsonSerializerContextand manually add a serialisation type for every return type.- Refit could probably add an implementation of
IHttpContentSerializerthat takesJsonSerializerContextor we could add a constructor to the current one - Manually adding a return type to
JsonSerializerContextis extremely cumbersome. I had the scuffed idea to take all the code fromSystem.Text.Json.SourceGenerator, add it to refit, and then emit a serialiser that can handle all of the users type. This is to get around the limit around source generators not being able to call one another.
(This should be opt in via an attribute)
- Refit could probably add an implementation of
Related #1389
Codecov Report
Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
Project coverage is 85.37%. Comparing base (
6ebeda5) to head (325753d).
Report is 184 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| Refit/DynamicallyAccessedMembersAttribute.cs | 0.00% | 4 Missing ⚠️ |
Additional details and impacted files
@@ Coverage Diff @@ ## main #1973 +/- ## ========================================== - Coverage 87.73% 85.37% -2.36% ========================================== Files 33 37 +4 Lines 2348 2510 +162 Branches 294 365 +71 ========================================== + Hits 2060 2143 +83 - Misses 208 289 +81 + Partials 80 78 -2
☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.
🚀 New features to boost your workflow:
- ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
github-actions
bot
locked as resolved and limited conversation to collaborators
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters