-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add support for new feature switch #14432
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
Changes from all commits
2975de6
9e749e5
e0d05e0
3ec30d7
cb4df10
d1d9db8
f614776
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
| using Microsoft.NET.TestFramework.Assertions; | ||
| using Microsoft.NET.TestFramework.Commands; | ||
| using Microsoft.NET.TestFramework.ProjectConstruction; | ||
| using Newtonsoft.Json.Linq; | ||
| using Xunit; | ||
| using Xunit.Abstractions; | ||
|
|
||
|
|
@@ -372,6 +373,40 @@ public void ILLink_verify_analysis_warnings_hello_world_app(string targetFramewo | |
| Assert.True(!missingWarnings.Any() && !extraWarnings.Any(), errorMessage); | ||
| } | ||
|
|
||
| [Theory] | ||
| [InlineData("net5.0")] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is great point - we should probably only change the default for |
||
| [InlineData("net6.0")] | ||
|
mateoatr marked this conversation as resolved.
|
||
| public void StartupHookSupport_is_false_by_default_on_trimmed_apps(string targetFramework) | ||
| { | ||
| var projectName = "HelloWorld"; | ||
| var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); | ||
|
|
||
| var testProject = CreateTestProjectForILLinkTesting(targetFramework, projectName); | ||
| var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: projectName); | ||
|
|
||
| var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); | ||
| publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true") | ||
| .Should().Pass(); | ||
|
|
||
| string outputDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; | ||
| string runtimeConfigFile = Path.Combine(outputDirectory, $"{projectName}.runtimeconfig.json"); | ||
| string runtimeConfigContents = File.ReadAllText(runtimeConfigFile); | ||
|
|
||
|
|
||
| if (Version.TryParse(targetFramework.TrimStart("net".ToCharArray()), out Version parsedVersion) && | ||
| parsedVersion.Major >= 6) | ||
| { | ||
| JObject runtimeConfig = JObject.Parse(runtimeConfigContents); | ||
| runtimeConfig["runtimeOptions"]["configProperties"] | ||
| ["System.StartupHookProvider.IsSupported"].Value<bool>() | ||
| .Should().Be(false); | ||
| } | ||
| else | ||
| { | ||
| runtimeConfigContents.Should().NotContain("System.StartupHookProvider.IsSupported"); | ||
| } | ||
| } | ||
|
|
||
| [Theory] | ||
| [InlineData("netcoreapp3.0")] | ||
| public void ILLink_accepts_root_descriptor(string targetFramework) | ||
|
|
||
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
PublishTrimmedbefore 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.