Skip to content

Conversation

@bkoelman
Copy link
Member

@bkoelman bkoelman commented Oct 19, 2025

Refactored the Controller source generator to use the newer incremental API, which is supposed to massively improve typing performance in the IDE.

Improvements:

  • Pipeline of cacheable outputs to improve performance during typing in IDEs.
  • Optimized execution time of core analysis logic.
  • In case of a crash during code generation, the generated file contains a #error line with commented-out details.
  • Improved auto-rename of duplicate files (happens when the same type name appears in multiple namespaces).
  • The generated list of namespace imports is sorted alphabetically.
  • Allow resource types declared as record instead of class.

Requires Visual Studio 2022 v17.13 or higher.

Closes #1447.

QUALITY CHECKLIST

@bkoelman bkoelman force-pushed the incremental-source-generator branch from b025fdd to 45e72ef Compare October 19, 2025 16:00
@codecov
Copy link

codecov bot commented Oct 19, 2025

Codecov Report

❌ Patch coverage is 88.18182% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.80%. Comparing base (49511f4) to head (0fd9c7f).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...Core.SourceGenerators/ControllerSourceGenerator.cs 90.59% 4 Missing and 7 partials ⚠️
...eGenerators/ImmutableDictionaryEqualityComparer.cs 15.38% 10 Missing and 1 partial ⚠️
...JsonApiDotNetCore.SourceGenerators/LocationInfo.cs 57.14% 2 Missing and 1 partial ⚠️
...ApiDotNetCore.SourceGenerators/SourceCodeWriter.cs 97.67% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1814      +/-   ##
==========================================
- Coverage   92.87%   92.80%   -0.08%     
==========================================
  Files         431      437       +6     
  Lines       14686    14809     +123     
  Branches     2361     2388      +27     
==========================================
+ Hits        13640    13743     +103     
- Misses        638      651      +13     
- Partials      408      415       +7     

☔ 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.

@bkoelman bkoelman force-pushed the incremental-source-generator branch 4 times, most recently from 479b85e to 9b01d2a Compare October 19, 2025 22:27
@bkoelman bkoelman marked this pull request as ready for review October 19, 2025 22:30
@bkoelman bkoelman force-pushed the incremental-source-generator branch 4 times, most recently from 188b3d3 to c75622b Compare October 19, 2025 23:31
@bkoelman bkoelman force-pushed the incremental-source-generator branch from c75622b to 0fd9c7f Compare October 19, 2025 23:55
@bkoelman bkoelman merged commit e0724b3 into master Oct 20, 2025
16 checks passed
@bkoelman bkoelman deleted the incremental-source-generator branch October 20, 2025 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Update controller source generator to incremental

2 participants