const deps_entry_t& try_ni(const deps_entry_t& entry) const;
+ pal::string_t get_deps_file() const
+ {
+ return m_deps_file;
+ }
+
private:
bool load_standalone(const pal::string_t& deps_path, const json_value& json, const pal::string_t& target_name);
bool load_portable(const pal::string_t& deps_path, const json_value& json, const pal::string_t& target_name, const rid_fallback_graph_t& rid_fallback_graph);
rid_fallback_graph_t m_rid_fallback_graph;
bool m_file_exists;
bool m_valid;
+
+ pal::string_t m_deps_file;
};
#endif // __DEPS_FORMAT_H_
{
for (int i = 1; i < m_fx_definitions.size(); ++i)
{
- // We'll search deps files in 'base_dir'/shared/fx_name/fx_ver
+ // We'll search deps files in 'base_dir'/shared/fx_name/fx_requested_ver
pal::string_t additional_deps_path_fx = additional_deps_path;
append_path(&additional_deps_path_fx, _X("shared"));
append_path(&additional_deps_path_fx, m_fx_definitions[i]->get_name().c_str());
- append_path(&additional_deps_path_fx, m_fx_definitions[i]->get_found_version().c_str());
+ append_path(&additional_deps_path_fx, m_fx_definitions[i]->get_requested_version().c_str()); // Use requested version as that is what the app deployed with
// The resulting list will be empty if 'additional_deps_path_fx' is not a valid directory path
std::vector<pal::string_t> list;
DeleteAvailableSharedFxVersions(_exeSharedUberFxBaseDir, "7777.0.0");
}
+ [Fact]
+ public void Additional_Deps_Lightup_Folder_With_Roll_Forward_And_Bad_JsonFile()
+ {
+ var fixture = PreviouslyBuiltAndRestoredPortableTestProjectFixture
+ .Copy();
+
+ var dotnet = fixture.BuiltDotnet;
+ var appDll = fixture.TestProject.AppDll;
+
+ // Add version in the exe folder
+ AddAvailableSharedFxVersions(_exeSharedFxBaseDir, "9999.0.1");
+
+ // Set desired version = 9999.0.0
+ string runtimeConfig = Path.Combine(fixture.TestProject.OutputDirectory, "SharedFxLookupPortableApp.runtimeconfig.json");
+ SetRuntimeConfigJson(runtimeConfig, "9999.0.0");
+
+ // Create a deps.json file in the folder "additionalDeps\shared\Microsoft.NETCore.App\9999.0.0"
+ string additionalDepsRootPath = Path.Combine(_exeSharedFxBaseDir, "additionalDeps");
+ string additionalDepsPath = Path.Combine(additionalDepsRootPath, "shared", "Microsoft.NETCore.App", "9999.0.0", "myAddtionalDeps.deps.json");
+ FileInfo additionalDepsFile = new FileInfo(additionalDepsPath);
+ additionalDepsFile.Directory.Create();
+ File.WriteAllText(additionalDepsFile.FullName, "THIS IS A BAD JSON FILE");
+
+ // Version: NetCoreApp 9999.0.0
+ // Exe: NetCoreApp 9999.0.1
+ // Expected: 9999.0.1
+ // Expected: the "specified" location (9999.0.0) is used to find the lightup folder, not the "found" location (9999.0.1)
+ dotnet.Exec("exec", "--additional-deps", additionalDepsRootPath, appDll)
+ .WorkingDirectory(_currentWorkingDir)
+ .EnvironmentVariable("COREHOST_TRACE", "1")
+ .CaptureStdOut()
+ .CaptureStdErr()
+ .Execute()
+ .Should()
+ .Fail()
+ .And
+ .HaveStdErrContaining(Path.Combine(_exeSelectedMessage, "9999.0.1"))
+ .And
+ .HaveStdErrContaining($"Error initializing the dependency resolver: An error occurred while parsing: {additionalDepsPath}");
+
+ DeleteAvailableSharedFxVersions(_exeSharedFxBaseDir, "9999.0.1", "additionalDeps");
+ }
+
// This method adds a list of new framework version folders in the specified
// sharedFxBaseDir. The files are copied from the _buildSharedFxDir.
// Remarks: