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

Check for <framework_name>.deps.json when enumerating framework paths #90035

Merged
merged 1 commit into from
Aug 7, 2023

Conversation

elinor-fung
Copy link
Member

This adds a check for the framework's .deps.json instead of just the existence of the directory. To avoid extra file checks in the normal/happy path (where all framework version folder are valid), when resolving, it only does the check after resolving the best version match. And if that version directory isn't valid, it tries resolving again without it.

This is the framework counterpart of the check for SDK paths: #89333

Fixes #48180

@ghost
Copy link

ghost commented Aug 4, 2023

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

Issue Details

This adds a check for the framework's .deps.json instead of just the existence of the directory. To avoid extra file checks in the normal/happy path (where all framework version folder are valid), when resolving, it only does the check after resolving the best version match. And if that version directory isn't valid, it tries resolving again without it.

This is the framework counterpart of the check for SDK paths: #89333

Fixes #48180

Author: elinor-fung
Assignees: -
Labels:

area-Host

Milestone: -

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.

LGTM

// Check that the framework's .deps.json exists.
pal::string_t fx_version_dir = fx_dir;
append_path(&fx_version_dir, ver.c_str());
if (!library_exists_in_dir(fx_version_dir, fx_name_local + _X(".deps.json"), nullptr))
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Maybe as a future cleanup - rename the helper as it's not about libraries... just files.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will plan to do that in a future cleanup.

@elinor-fung elinor-fung changed the title Check for <framework_name>.deps.json when enumerationg framework paths Check for <framework_name>.deps.json when enumerating framework paths Aug 7, 2023
@elinor-fung elinor-fung merged commit 26103db into dotnet:main Aug 7, 2023
165 of 168 checks passed
@elinor-fung elinor-fung deleted the checkFrameworkDepsJson branch August 7, 2023 05:07
@ghost ghost locked as resolved and limited conversation to collaborators Sep 6, 2023
@elinor-fung
Copy link
Member Author

/backport to release/6.0-staging

@elinor-fung
Copy link
Member Author

/backport to release/7.0-staging

@github-actions github-actions bot unlocked this conversation Sep 13, 2023
@github-actions
Copy link
Contributor

Started backporting to release/6.0-staging: https://github.com/dotnet/runtime/actions/runs/6175735401

@github-actions
Copy link
Contributor

Started backporting to release/7.0-staging: https://github.com/dotnet/runtime/actions/runs/6175737271

@github-actions
Copy link
Contributor

@elinor-fung backporting to release/6.0-staging failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: Check for <framework_name>.deps.json when enumerationg framework paths
Using index info to reconstruct a base tree...
M	src/installer/tests/HostActivation.Tests/FrameworkResolution/MultipleHives.cs
M	src/installer/tests/HostActivation.Tests/NativeHostApis.cs
M	src/installer/tests/TestUtils/DotNetBuilder.cs
M	src/native/corehost/fxr/framework_info.cpp
M	src/native/corehost/fxr/framework_info.h
M	src/native/corehost/fxr/fx_resolver.cpp
M	src/native/corehost/fxr/fx_resolver.messages.cpp
M	src/native/corehost/fxr/hostfxr.cpp
Falling back to patching base and 3-way merge...
Auto-merging src/native/corehost/fxr/hostfxr.cpp
CONFLICT (content): Merge conflict in src/native/corehost/fxr/hostfxr.cpp
Auto-merging src/native/corehost/fxr/fx_resolver.messages.cpp
CONFLICT (content): Merge conflict in src/native/corehost/fxr/fx_resolver.messages.cpp
Auto-merging src/native/corehost/fxr/fx_resolver.cpp
CONFLICT (content): Merge conflict in src/native/corehost/fxr/fx_resolver.cpp
Auto-merging src/native/corehost/fxr/framework_info.h
CONFLICT (content): Merge conflict in src/native/corehost/fxr/framework_info.h
Auto-merging src/native/corehost/fxr/framework_info.cpp
CONFLICT (content): Merge conflict in src/native/corehost/fxr/framework_info.cpp
Auto-merging src/installer/tests/TestUtils/DotNetBuilder.cs
Auto-merging src/installer/tests/HostActivation.Tests/NativeHostApis.cs
CONFLICT (content): Merge conflict in src/installer/tests/HostActivation.Tests/NativeHostApis.cs
Auto-merging src/installer/tests/HostActivation.Tests/FrameworkResolution/MultipleHives.cs
CONFLICT (content): Merge conflict in src/installer/tests/HostActivation.Tests/FrameworkResolution/MultipleHives.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Check for <framework_name>.deps.json when enumerationg framework paths
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

@github-actions
Copy link
Contributor

@elinor-fung an error occurred while backporting to release/6.0-staging, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 13, 2023
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.

Framework resolution should perform basic validation of frameworks
2 participants