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 the FX_RESOLUTION Runtime property #644

Closed
wants to merge 4 commits into from

Conversation

swaroop-sridhar
Copy link
Contributor

@swaroop-sridhar swaroop-sridhar commented Dec 7, 2019

As part of https://github.com/dotnet/core-setup/issues/4112, this change modifies hostpolicy
to pass an additional property describing framework-resolution
to the runtime.

For each framework resolved (if any), FX_RESOLUTION notes:
Framework: <name>, Requested: <min-requested-version>, Resolved: <actual-resolved-version>;

Copy link
Member

@vitek-karas vitek-karas left a comment

Choose a reason for hiding this comment

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

Missing tests

@@ -203,7 +203,8 @@ namespace
_X("JIT_PATH"),
_X("STARTUP_HOOKS"),
_X("APP_PATHS"),
_X("APP_NI_PATHS")
_X("APP_NI_PATHS"),
_X("FX_RESOLUTION")
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I would probably call this RESOLVED_FRAMEWORKS.

@@ -125,6 +125,26 @@ int hostpolicy_context_t::initialize(hostpolicy_init_t &hostpolicy_init, const a
++fx_curr;
}

pal::string_t fx_resolution;
bool is_app = true;
for (const auto& fx : fx_definitions)
Copy link
Member

Choose a reason for hiding this comment

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

This can be folded into the existing loop which wills app_context_deps_str right above this as that already iterates over all FX definitions. There will need to be some changes around the "app" framework, but in general it should be done in one place as it's basically the same thing.

@swaroop-sridhar
Copy link
Contributor Author

Thanks @vitek-karas, I've made the changes you suggested.

@@ -114,13 +114,29 @@ int hostpolicy_context_t::initialize(hostpolicy_init_t &hostpolicy_init, const a
fx_definition_vector_t::iterator fx_end;
resolver.get_app_fx_definition_range(&fx_begin, &fx_end);
Copy link
Member

Choose a reason for hiding this comment

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

This excludes the "App" when in libhost mode - so the loop below would actually skip the first framework.
We may need to tweak the behavior of this helper in correspondence with the loop.

}

[Fact]
public void ResolvedFrameworksPropertyIsComputedForPortableApps()
Copy link
Member

Choose a reason for hiding this comment

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

Can you please add a test for cases where the requested version doesn't match the resolved version?
Ideally also a test with multiple resolved frameworks, but that is a bit harder to do.

As part of core-setup/dotnet#4112, this change modifies hostpolicy
to pass an additional property describing framework-resolution
to the runtime.

For each framework resolved (if any), FX_RESOLUTION notes:
Framework: <name>, Requested: <min-requested-version>, Resolved: <actual-resolved-version>;
* Fix HostPolicy change to incorporate libhost mode
* Update test with a case where requested and actual frameworks are different

Add some more changes

Test

Test with different netcoreapp versions

app_context_deps_str += (*fx_curr)->get_deps_file();
++fx_curr;
app_context_deps_str += fx->get_deps_file();
Copy link
Member

Choose a reason for hiding this comment

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

Before your change the app.deps.json was not included in this string when running in libhost mode (since only real frameworks should be reported then). Now it will include it.
Can you please adapt some of the existing libhost tests and validate this property and that it doesn't regress with this change?

@@ -114,15 +114,38 @@ int hostpolicy_context_t::initialize(hostpolicy_init_t &hostpolicy_init, const a
fx_definition_vector_t::iterator fx_end;
resolver.get_app_fx_definition_range(&fx_begin, &fx_end);
Copy link
Member

Choose a reason for hiding this comment

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

If I read it correctly these are not used anymore.

pal::string_t app_context_deps_str;
fx_definition_vector_t::iterator fx_curr = fx_begin;
while (fx_curr != fx_end)
bool is_app = host_mode != host_mode_t::libhost;
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't the first element in fx_definitions represent the app even in libhost mode?

@@ -0,0 +1,14 @@
<Project>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to explicitly do the imports for some reason instead of just setting the Sdk attribute on the project?

@stephentoub
Copy link
Member

@swaroop-sridhar, still working on this? Thanks.

@swaroop-sridhar
Copy link
Contributor Author

swaroop-sridhar commented Feb 18, 2020

@stephentoub Yes I'm working on this PR and the related #690 in the background.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants