-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 support for new feature switch #14432
Conversation
@samsp-msft for naming of the new property I don't know if we picked a pattern - based on some of the others maybe it should be |
Should this change also include turning this on by default when |
Going through the discussion on dotnet/runtime#44050 a second time, I think it's settled that we should turn this on by default whenever PublishTrimmed is used. If there's no debate I'll make the change in this PR. |
@@ -22,6 +22,15 @@ Copyright (c) .NET Foundation. All rights reserved. | |||
<_LinkSemaphore>$(IntermediateOutputPath)Link.semaphore</_LinkSemaphore> | |||
</PropertyGroup> | |||
|
|||
<!-- We disable startup hooks for trimmed apps here so that the feature |
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.
Should this go into a props file so that it can actually be overriden from a project?
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.
It can't go into a .props file because then the project wouldn't get a chance to set PublishTrimmed
before this check happens.
So instead, the check below should be
<PropertyGroup Condition="'$(StartupHookSupport)' == '' AND '$(PublishTrimmed)' == 'true'>
which will allow for both to be set in the project file.
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ILLink.targets
Outdated
Show resolved
Hide resolved
My understanding of the existing naming pattern is that Following this pattern kind of poses a problem here since I think my main concern is that whatever we decide, we should be consistent between the runtimeconfig/AppContext name and the MSBuild property name. Don't use |
I like @eerhardt view on this. Just comment about the default settings: The default is somewhat tricky, as you could also argue that EventSourceSupport is off by default for Blazor projects. |
Add the new feature switch to the "all feature switches" test in sdk/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAProjectWithAllFeatures.cs Line 30 in 0df7598
|
I filed #14475 to track the default values for feature switches in trimmed apps |
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
Outdated
Show resolved
Hide resolved
@@ -372,6 +373,29 @@ public void ILLink_verify_analysis_warnings_hello_world_app(string targetFramewo | |||
Assert.True(!missingWarnings.Any() && !extraWarnings.Any(), errorMessage); | |||
} | |||
|
|||
[Theory] | |||
[InlineData("net5.0")] |
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.
Since net5.0
has already shipped, Should we be considering this a breaking change when users start building their existing net5.0
apps with the 6.0 SDK?
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.
This is great point - we should probably only change the default for net6.0
and above. Everything else can stay the same, just changing the default value of the feature switch when trimming should only happen for net6.0
apps and above.
This adds SDK support for StartupHookSupport, a new feature switch that allows users to disable startup hooks.
Related to #14385.