Skip to content

Default values for feature switches in trimmed console apps #14475

@vitek-karas

Description

@vitek-karas

Runtime repo has been introducing feature switches which among other things help reduce application size when the app is trimmed. They also help avoid trim analysis warnings. This issue is to determine and implement the default values for various feature switches when trimming is turned on.

Ideally the experience would be that trimming a template console app doesn't produce any trim analysis warnings and the size of the app is as small as possible. Downside of turning off features by default is obviously potentially unexpected change of behavior of the app.

For description of the feature switches please refer to feature-switches.md

MSBuild Property Name Default Default when PublishTrimmed=true Notes
StartupHookSupport true false https://github.com/dotnet/sdk/pull/14432/files
DebuggerSupport true true (unchanged) Don't want to break diagnostics
EnableUnsafeUTF7Encoding false false (unchanged) Already turned off by default, so no-op
EnableUnsafeBinaryFormatterSerialization true / false in ASP.NET false The plan is to turn this off in future releases, so doing so for trimming in 6.0 seems OK
EventSourceSupport true true (unchanged) Don't want to break diagnostics
InvariantGlobalization false ??? Needs investigation how much it actually helps for console apps
UseSystemResourceKeys false ???
HttpActivityPropagationSupport true true (unchanged) Don't want to break diagnostics

TODO:

  • Measure size impact of each of these on a sample console app (so that we have data to drive the decisions)
  • Measure how many warnings are produced if these are left turned on

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions