-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Options Validation source generator runs primary code generation phase on keypress #93313
Comments
Tagging subscribers to this area: @dotnet/area-extensions-options Issue DetailsDescriptionSee more detail in #92914. Reproduction StepsCreate a project that uses Options Validation source generator. Observe it's execution pattern - either in the debugger or through ETW. Expected behaviorChanges unrelated to the options validation code and it's type closure should not trigger regeneration of the options source. Actual behaviorEvery change causes the entire pipeline to rerun. Regression?No Known WorkaroundsWe 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. <Target Name="_disableOptionsGeneratorInDesignTime" BeforeTargets="ResolveOffByDefaultAnalyzers">
<ItemGroup Condition="'$(DesignTimeBuild)' == 'true' OR '$(BuildingProject)' != 'true'">
<OffByDefaultAnalyzer Include="Microsoft.Extensions.Options.SourceGeneration.dll"
IsEnabled="$(EnableOptionsGenerator)"/>
</ItemGroup>
</Target> ConfigurationNo response Other informationNo response
|
It looks like VS noticed the impact of this generator as well, causing 0.21% regression on a typing benchmark for razor pages. When fixing this we should be comparing performance to other well-behaved incremental generators (RegEx, Interop, Json) to ensure we raise enough of the data model to the incremental pipeline so that we don't end up calling the expensive part of our pipeline of every change. |
No, the urgent fix was already submitted. |
Thank you for confirming @sharwell. We will get to this in 9.0 I just wanted to make sure we were on the same page. |
We discussed improving the incremental characteristics of the runtime source generators and scoped it out of 9.0 |
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:
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: