Skip to content
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

Add SDK Support for new runtime feature switches #12217

Closed
eerhardt opened this issue Jun 26, 2020 · 2 comments · Fixed by #12457
Closed

Add SDK Support for new runtime feature switches #12217

eerhardt opened this issue Jun 26, 2020 · 2 comments · Fixed by #12457
Milestone

Comments

@eerhardt
Copy link
Member

eerhardt commented Jun 26, 2020

We are introducing new runtime options in dotnet/runtime to allow unnecessary code to be trimmed in size sensitive apps (Blazor, Xamarin).

To complete this experience we should add a RuntimeHostConfigurationOption and MSBuild property to set each feature switch. For example:

    <RuntimeHostConfigurationOption Include="System.Diagnostics.Tracing.EventSource.IsSupported"
                                    Condition="'$(EventSourceSupport)' != ''"
                                    Value="$(EventSourceSupport)"
                                    Trim="true" />

Feature switches being added to dotnet/runtime:

We also should add Trim='true' for the System.Globalization.Invariant RuntimeHostConfigurationOption so the non-invariant globalization code can be trimmed.

@marek-safar marek-safar added this to the 5.0.1xx milestone Jun 26, 2020
@eerhardt eerhardt changed the title Add SDK Support for EventSource IsSupported feature switch Add SDK Support for new runtime feature switches Jun 30, 2020
eerhardt added a commit to eerhardt/sdk that referenced this issue Jul 6, 2020
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
eerhardt added a commit that referenced this issue Jul 7, 2020
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 #12217
@GrabYourPitchforks
Copy link
Member

@eerhardt What's the expected behavior if a setting is specified in both the .csproj and the runtimeconfig.json file? From some quick experiments it looks like the build output contains the .csproj's value rather than the .json's value. Just wanted to verify that this met your expectations.

Context: the aspnet core SDK targets file will contain <EnableBinaryFormatter>false</EnableBinaryFormatter>. But if a developer wants to re-enable it, this means that they're forced to make a change to the .csproj rather than having the option of making the change to runtimeconfig.json. I'm trying to figure out if this is an acceptable scenario, as there might be some web applications where the .csproj is auto-generated and devs might not be able to modify those entries.

@eerhardt
Copy link
Member Author

@eerhardt What's the expected behavior if a setting is specified in both the .csproj and the runtimeconfig.json file?

See the comment here:

// HostConfigurationOptions are added after AddUserRuntimeOptions so if there are
// conflicts the HostConfigurationOptions win. The reasoning is that HostConfigurationOptions
// can be changed using MSBuild properties, which can be specified at build time.
AddHostConfigurationOptions(config.RuntimeOptions);

So yes, the intention is that the settings in the .csproj will always win over a conflicting runtimeconfig.template.json setting.

eerhardt added a commit to eerhardt/sdk that referenced this issue Jul 14, 2020
…gation

These feature switches were added in the runtime:
* Debugger - dotnet/runtime#37288
* Http activity propagation - dotnet/runtime#38765

Fix dotnet#12217
eerhardt added a commit that referenced this issue Jul 15, 2020
…gation (#12457)

These feature switches were added in the runtime:
* Debugger - dotnet/runtime#37288
* Http activity propagation - dotnet/runtime#38765

Fix #12217
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants