8000 Combining the CompilationProvider is an anti-pattern, create an IncrementalValueProvider for the assembly name instead. by m-gasser · Pull Request #8021 · ChilliCream/graphql-platform · GitHub
[go: up one dir, main page]

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

Combining the CompilationProvider is an anti-pattern, create an IncrementalValueProvider for the assembly name instead. #8021

Merged

Conversation

m-gasser
Copy link
Contributor

Combining the CompilationProvider is an anti-pattern, create an IncrementalValueProvider for the assembly name instead.

See https://github.com/dotnet/roslyn/blob/main/docs/features/incremental-generators.md where combining the CompilationProvider is given as a sample how to not do it.

Consider the following (incorrect) combine where the basic inputs are combined, then used to generate some source:

public void Initialize(IncrementalGeneratorInitializationContext context)
{
var compilation = context.CompilationProvider;
var texts = context.AdditionalTextsProvider;

// Don't do this!
var combined = texts.Combine(compilation);

context.RegisterSourceOutput(combined, static (spc, pair) =>
{
    var assemblyName = pair.Right.AssemblyName;
    // produce source ...
});

…mentalValueProvider for the assembly name instead.
@CLAassistant
Copy link
CLAassistant commented Feb 13, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
codecov bot commented Feb 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.42%. Comparing base (01f3016) to head (6afa163).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8021   +/-   ##
=======================================
  Coverage   74.42%   74.42%           
=======================================
  Files        2902     2902           
  Lines      152515   152516    +1     
  Branches    17794    17794           
=======================================
+ Hits       113507   113508    +1     
- Misses      33100    33101    +1     
+ Partials     5908     5907    -1     
Flag Coverage Δ
unittests 74.42% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@michaelstaib michaelstaib added this to the HC-15.1.0 milestone Feb 17, 2025
@michaelstaib
Copy link
Member

Hey @m-gasser,

thank you for your contribution!

8000

@michaelstaib michaelstaib merged commit 981f833 into ChilliCream:main Feb 17, 2025
3 checks passed
michaelstaib added a commit that referenced this pull request Feb 19, 2025
* [Fusion] Added post-merge validation rule "EmptyMergedInputObjectTypeRule" (#7993)

* [Fusion] Refactored merging to ensure correct type references (#7995)

* Fixed CookieCrumble Package Configurations. (#7998)

* [Fusion] Added merging of implemented interfaces (#7999)

* Added more include overloads. (#8002)

* [Fusion] Used `@fusion__inaccessible` in the execution schema (#8005)

* Added support for LocalDate/LocalDateTime/LocalTime to Strawberry Shake (#8007)

* Request totalCount through ToPageAsync if its requested. (#8011)

* Added QueryContext extension methods for Select and Include. (#8013)

* Switched LangVersion from `preview` to `13.0` (#8014)

* Updated .NET 9 packages (#8012)

* Changed the runtime type for the Date scalar in Strawberry Shake (#8009)

* Added Strawberry Shake runtime type change to migration guide (#8010)

* Migrated to new solution file format. (#8027)

* Combining the CompilationProvider is an anti-pattern, create an IncrementalValueProvider for the assembly name instead. (#8021)

* Fixed ignored invalid field when enum is present (#8026)

* Allow for internal DataLoader modules and groups. (#8028)

* Updated the latest stable version for the docs to v15 (#8018)

* Added documentation directory for Fusion v15 (#8017)

* Added Strawberry Shake migration documents to `docs.json` (#8015)

* [Fusion] Fix explosion of selections (#8030)

---------

Co-authored-by: Daniel Reynolds <55194784+danielreynolds1@users.noreply.github.com>
Co-authored-by: Michael Staib <michael@chillicream.com>
Co-authored-by: Martin Gasser <m-gasser@gmx.net>
Co-authored-by: faddiv <faddiv@gmail.com>
Co-authored-by: Tobias Tengler <45513122+tobias-tengler@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0