Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@TimothyMakkison
Copy link
Contributor

@TimothyMakkison TimothyMakkison commented Apr 18, 2025

Start to suppress AOT warnings

  • Add a NET Standard 2.0 version of DynamicallyAccessedMembers to 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 RefitSettings interfaces, this might be an issue.
  • Query serialisation will need the user to annotate DynamicallyAccessedMembers for 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 JsonSerializerContext and manually add a serialisation type for every return type.
    • Refit could probably add an implementation of IHttpContentSerializer that takes JsonSerializerContext or we could add a constructor to the current one
    • Manually adding a return type to JsonSerializerContext is extremely cumbersome. I had the scuffed idea to take all the code from System.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)

Related #1389

@codecov
Copy link

codecov bot commented Apr 18, 2025

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.

@TimothyMakkison TimothyMakkison marked this pull request as ready for review April 18, 2025 23:20
@ChrisPulman ChrisPulman merged commit 4bbe565 into reactiveui:main Apr 23, 2025
1 of 3 checks passed
@github-actions
Copy link

github-actions bot commented May 8, 2025

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 github-actions bot locked as resolved and limited conversation to collaborators May 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants