-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add SDK Support for new runtime feature switches #12362
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
Conversation
Adds 3 runtimeconfig.json options introduced in .NET 5 that allow for code to be trimmed out of an application. * EventSource.IsSupported * UseSystemResourceKeys * EnableUnsafeUTF7Encoding Also fixing InvariantGlobalization so it is passed to the linker correctly. Contributes to dotnet#12217
| <TieredCompilationQuickJit>true</TieredCompilationQuickJit> | ||
| <TieredCompilationQuickJitForLoops>true</TieredCompilationQuickJitForLoops> | ||
| <EventSourceSupport>false</EventSourceSupport> | ||
| <UseSystemResourceKeys>true</UseSystemResourceKeys> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comment not directly from your PR is do we want to add some common prefix/sufix to these properties so that it is a bit obvious they are related and about the linker?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so that it is a bit obvious they are related and about the linker?
These options are not just about the linker - just like the $(InvariantGlobalization) property. These properties control runtime behavior. Setting these properties in any .NET 5 application will change its behavior as specified, since we set the value in the runtimeconfig.json. You don't need to run the linker in order to get the behavior. Yes, the linker recognizes and reacts to these properties, but to a user that is less important than the runtime behavior change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the design goals of the feature switches is to define a general-purpose pattern we use for features - the linker's ability to drop code for disabled features is just one use case (you could in theory disable a feature without linking for example) - so I think we don't need a prefix. edit: as usual @eerhardt beat me to it :)
joperezr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking care of mine too 😄
| <RuntimeHostConfigurationOption Include="System.Text.Encoding.EnableUnsafeUTF7Encoding" | ||
| Condition="'$(EnableUnsafeUTF7Encoding)' != ''" | ||
| Value="$(EnableUnsafeUTF7Encoding)" | ||
| Trim="true" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm, "trim=true" means "this setting participates in the trimming process," not "enable trimming only if the value is set to true," correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. This value gets passed into the linker when Trim=true is set on it. See
| <_TrimmerFeatureSettings Include="@(RuntimeHostConfigurationOption)" Condition="'%(RuntimeHostConfigurationOption.Trim)' == 'true'" /> |
Adds 3 runtimeconfig.json options introduced in .NET 5 that allow for code to be trimmed out of an application.
Also fixing InvariantGlobalization so it is passed to the linker correctly.
Contributes to #12217