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 templated probing path to store for developer scenarios #1306

Merged
merged 4 commits into from
Jun 7, 2017

Conversation

ramarag
Copy link
Member

@ramarag ramarag commented Jun 5, 2017

This is a followup of dotnet/core-setup#2539
Fixes #1298

@eerhardt @gkhanna79 PTAL

@@ -220,7 +220,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<PropertyGroup>
<DefaultComposeDir>$(HOME)</DefaultComposeDir>
<DefaultComposeDir Condition="'$(OS)' == 'Windows_NT'">$(USERPROFILE)</DefaultComposeDir>
<DefaultComposeDir>$([System.IO.Path]::Combine($(DefaultComposeDir), '.dotnet', $(PlatformTarget), 'store'))</DefaultComposeDir>
<DefaultComposeDir>$([System.IO.Path]::Combine($(DefaultComposeDir), '.dotnet', 'store'))</DefaultComposeDir>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does Store output folder get the architecture now from?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we removing this? I would not have expected this to happen.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously userprofile store was in
<user_profile><arch>\store

since we have removed both sdk and shared Fx from user_profile, this location no longer makes sense. I have moved store now under <user_profile>

The tooling adds and and passes this path as an additional probing path for developer scenarios

@gkhanna79
Copy link
Member

gkhanna79 commented Jun 6, 2017 via email

@ramarag
Copy link
Member Author

ramarag commented Jun 6, 2017

In reply to #1306 (comment)
Yes

@ramarag
Copy link
Member Author

ramarag commented Jun 6, 2017

cc @livarcocc @nguerrera

@gkhanna79
Copy link
Member

gkhanna79 commented Jun 6, 2017 via email

Copy link
Member

@gkhanna79 gkhanna79 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eerhardt PTAL as well.

@@ -108,6 +109,16 @@ public void It_targets_the_right_framework_depending_on_output_type(bool selfCon
actualRuntimeFrameworkVersion.Should().Be(expectedRuntimeVersion);
}

string devruntimeConfigFile = Path.Combine(outputDirectory.FullName, testProject.Name + ".runtimeconfig.dev.json");
if (File.Exists(devruntimeConfigFile))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should assert that the file exists, not silently ignore when the file doesn't exist.

}

//Add developer profile store location as the first path to probe
var developerProfileStore = DeveloperStoreLocation + "/.dotnet/store/|arch|/|tfm|";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels odd that we are passing part of the path in on a parameter named DeveloperStoreLocation, and then the C# code appends more folders to the path.

Instead, I would expect the whole path to be built in one location (the MSBuild targets), and then passed in. That way if, for whatever reason, someone can modify the whole path, if necessary.

Also, maybe it would be more extensible to have the parameter be "AdditionalProbingPaths" and take a list of paths. Then the MSBuild targets just passes in one, but we can add more later (or someone else can). Thoughts?

@@ -140,6 +140,11 @@ Copyright (c) .NET Foundation. All rights reserved.
Inputs="$(ProjectAssetsFile);$(UserRuntimeConfig)"
Outputs="$(ProjectRuntimeConfigFilePath);$(ProjectRuntimeConfigDevFilePath)">

<PropertyGroup>
<DeveloperStoreLocation>$(HOME)</DeveloperStoreLocation>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to reuse DefaultComposeDir here? Instead of duplicating this location between here and ComposeStore.targets.

@gkhanna79
Copy link
Member

@ramarag Can you get the feedback incorporated so that we can get the PR ready for approval?

@eerhardt
Copy link
Member

eerhardt commented Jun 6, 2017

If necessary, I can make the updates if @ramarag doesn't have the time.

@gkhanna79
Copy link
Member

@ramarag Will you be able to get the updates done by 1pm today? If not, @eerhardt it will be great if you can get them going.

@gkhanna79
Copy link
Member

@eerhardt Will you be able to get the changes for this?

@eerhardt
Copy link
Member

eerhardt commented Jun 6, 2017

Just started working on them now.

@bleroy
Copy link
Contributor

bleroy commented Jun 6, 2017

Does this need to be reflected in documentation?

@eerhardt
Copy link
Member

eerhardt commented Jun 6, 2017

Does this need to be reflected in documentation?

Do we have the multi-level lookup locations listed in the documentation? If so, yes. By default, the host only knows how to look next to itself and in the "global" (ProgramFiles) location for 'runtime stores'.

We removed the %USERPROFILE% location from the host and only add that location when you dotnet run or F5 a project. That location is not used in published applications.

GenerateRuntimeConfigurationFiles should take the list of additional probling paths.
Use a common property for the user profile store.
Test should assert the runtimeconfig.dev.json file is created.
@bleroy
Copy link
Contributor

bleroy commented Jun 6, 2017

Do we have the multi-level lookup locations listed in the documentation?

Currently, we don't, so I'll leave it that way, at least for now. Thanks.

@gkhanna79
Copy link
Member

Currently, we don't, so I'll leave it that way, at least for now.

See Proposed Changes section at https://github.com/dotnet/core-setup/blob/master/Documentation/design-docs/multilevel-sharedfx-lookup.md - they are documented.

@bleroy
Copy link
Contributor

bleroy commented Jun 6, 2017

Thanks, this is great. I meant on the docs.microsoft.com topic.

@@ -43,6 +43,8 @@ public class GenerateRuntimeConfigurationFiles : TaskBase

public ITaskItem[] HostConfigurationOptions { get; set; }

public ITaskItem[] AdditionalProbingPaths { get; set; }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use string[] here instead

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a slight preference to keeping ITaskItem in case we ever want to add metadata to these items.

@ramarag
Copy link
Member Author

ramarag commented Jun 6, 2017

LGTM

@gkhanna79
Copy link
Member

@eerhardt @nguerrera @livarcocc What are the next steps to get this merged?

@eerhardt
Copy link
Member

eerhardt commented Jun 7, 2017

@MattGertz for approval

Customer scenario

With the introduction of the dotnet store feature, we first allowed the host to look in %USERPROFILE%\.dotnet by default all the time. This way a developer could run dotnet store for a few dependencies, and then dotnet run their app, and the crossgen'd dependencies would be picked up from %USERPROFILE%.
We have since removed that location from the host because in production scenarios, we don't want it probing %USERPROFILE%.
This change adds the %USERPROFILE% location to be probed only at "dev-time" scenarios like dotnet run by adding it to the runtimeconfig.dev.json file, which isn't used in published apps.

Bugs this fixes:

#1298

Workarounds, if any

Developers would have to manually pass the %USERPROFILE%\.dotnet\store location on the command line every time they wanted to use a runtime store created by dotnet store.

Risk

Low - this re-enables the behavior that the host used to have, but only in dev time scenarios.

Performance impact

One new location is probed during dotnet run.
Developers can use dotnet store to crossgen their dependencies and get their projects executed faster using dotnet run.

Is this a regression from a previous update?

This behavior was consciously removed from the host and added to the SDK.

Root cause analysis:

This behavior was flagged as part of a security push for the new multi-level lookup feature.

How was the bug found?

Design/security review.

@MattGertz
Copy link

I agree & will take to JoC today.

@livarcocc
Copy link
Contributor

@MattGertz for approval. This is not a in-box change Matt.

@eerhardt eerhardt merged commit e4fc6f8 into dotnet:release/2.0.0 Jun 7, 2017
@eerhardt eerhardt deleted the store_for_f5 branch June 7, 2017 19:04
eerhardt added a commit to eerhardt/vstest that referenced this pull request Jun 8, 2017
dotnet/sdk#1306 brought in templated probing paths into the runtime.config.json.  These are breaking dotnet test because we assume the paths are valid.

Skipping any invalid paths by catching exceptions from Path.Combine.

Fixes microsoft#847
codito pushed a commit to microsoft/vstest that referenced this pull request Jun 9, 2017
dotnet/sdk#1306 brought in templated probing paths into the runtime.config.json.  These are breaking dotnet test because we assume the paths are valid.

Skipping any invalid paths by catching exceptions from Path.Combine.

Fixes #847
codito pushed a commit to microsoft/vstest that referenced this pull request Jun 9, 2017
dotnet/sdk#1306 brought in templated probing paths into the runtime.config.json.  These are breaking dotnet test because we assume the paths are valid.

Skipping any invalid paths by catching exceptions from Path.Combine.

Fixes #847
mmitche pushed a commit to mmitche/sdk that referenced this pull request Jun 5, 2020
…0200221.13 (dotnet#1306)

- Microsoft.AspNetCore.Analyzers - 5.0.0-preview.2.20121.13
- Microsoft.AspNetCore.Components.Analyzers - 5.0.0-preview.2.20121.13
- Microsoft.AspNetCore.Mvc.Analyzers - 5.0.0-preview.2.20121.13
- Microsoft.AspNetCore.Mvc.Api.Analyzers - 5.0.0-preview.2.20121.13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants