Respect disabled Avalonia name generator - #21804
Merged
Merged
Conversation
|
You can test this PR using the following package version. |
maxkatz6
approved these changes
Jul 20, 2026
MrJul
pushed a commit
that referenced
this pull request
Jul 29, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes
AvaloniaNameGeneratorIsEnabled=falsefor the Avalonia XAML name generator.The property is still defined in
Avalonia.Generators.propsand passed to the source generator throughCompilerVisibleProperty, and it is still read byGeneratorOptions. However, after the migration to the incremental source generator pipeline, the value was no longer checked, so setting:did not actually disable the name generator.
This PR restores the missing check and filters out XAML inputs before parsing/generation when the generator is disabled.
Regression
This was introduced in:
fca45c1
Migrate AvaloniaNameSourceGenerator to IIncrementalGenerator (#19216)
Author: @maxkatz6
Author date: 2025-08-13T13:22:14-07:00
Before that commit, the old AvaloniaNameSourceGenerator had an explicit gate:
During the migration to AvaloniaNameIncrementalGenerator, the option continued to be read by GeneratorOptions, but the actual enabled check was not ported to the new incremental pipeline.
Fix
The XAML input filter now returns false immediately when AvaloniaNameGeneratorIsEnabled is disabled:
This prevents the name generator from parsing XAML files and from producing generated .g.cs files when disabled, matching the previous behavior.