Description
Description
See more detail in #92914.
Reproduction Steps
Create a project that uses Options Validation source generator. Observe it's execution pattern - either in the debugger or through ETW.
Expected behavior
Changes unrelated to the options validation code and it's type closure should not trigger regeneration of the options source.
Actual behavior
Every change causes the entire pipeline to rerun.
Regression?
No
Known Workarounds
We haven't had reports of the performance here being a blocker, but that could be due to lack of use. The amount of work done on keypress will depend on whether or not the generator has work to do. If it has a lot of work to do, then it will be doing that work on every change.
Disable the options generator from design-time builds (this will result in errors where the generator is used, which are design time only errors).
Workaround:
<Target Name="_disableOptionsGeneratorInDesignTime" BeforeTargets="ResolveOffByDefaultAnalyzers">
<ItemGroup Condition="'$(DesignTimeBuild)' == 'true' OR '$(BuildingProject)' != 'true'">
<OffByDefaultAnalyzer Include="Microsoft.Extensions.Options.SourceGeneration.dll"
IsEnabled="$(EnableOptionsGenerator)"/>
</ItemGroup>
</Target>
Configuration
No response
Other information
No response