Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET7.0+ AOT supported #1710

Merged
merged 3 commits into from
Jun 9, 2024
Merged

.NET7.0+ AOT supported #1710

merged 3 commits into from
Jun 9, 2024

Conversation

xljiulang
Copy link
Contributor

What kind of change does this PR introduce?

This is an implementation complement to #1389, which enables Generated.g codes to be preserved during trimming, thereby supporting AOT publish of .NET 7.0 or later versions.This implementation has been used in the WebApiClient project and is valid for .NET versions 5.0 to 9.0 and is safe.

What is the current behavior?

<TrimMode>full</TrimMode> is the default behavior of .NET8. Once <PublishAot>true</PublishAot> is turned on, all the code currently generated in Generated.g will be trimmed, causing AOT publishing to fail.

What is the new behavior?

Cleverly use ModuleInitializerAttribute in combination with DynamicDependencyAttribute to prevent the code of Generated.g from being trimmed.

What might this PR break?
This PR is non-destructive, but requires the target project to be .NET 5 or above to take effect.

Please check if the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Other information:

Copy link

codecov bot commented Jun 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.62%. Comparing base (6ebeda5) to head (5784f2d).
Report is 32 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1710      +/-   ##
==========================================
- Coverage   87.73%   86.62%   -1.11%     
==========================================
  Files          33       34       +1     
  Lines        2348     2064     -284     
  Branches      294      296       +2     
==========================================
- Hits         2060     1788     -272     
+ Misses        208      199       -9     
+ Partials       80       77       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ChrisPulman ChrisPulman merged commit b944483 into reactiveui:main Jun 9, 2024
2 of 3 checks passed
Copy link

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 Jun 24, 2024
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