Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

ConfigurationManager fix for UAPAOT #20488

Merged
merged 2 commits into from
May 31, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,17 @@ private ClientConfigPaths(string exePath, bool includeUserConfig)
// used for local paths and "file://" for UNCs. Simply removing the prefix will make
// local paths relative on Unix (e.g. "file:///home" will become "home" instead of
// "/home").
Uri uri = new Uri(exeAssembly.CodeBase);
string configBasePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, exeAssembly.GetName().Name);
Copy link

Choose a reason for hiding this comment

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

You're not using exeAssembly.ManifestModule.Name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK , I will use ManifestModule.Name then

Uri uri = new Uri(configBasePath);

if (uri.IsFile)
{
ApplicationUri = uri.LocalPath;
applicationFilename = uri.LocalPath;
}
else
{
ApplicationUri = exeAssembly.EscapedCodeBase;
ApplicationUri = Uri.EscapeDataString(configBasePath);
}
}

Expand Down Expand Up @@ -201,7 +203,7 @@ private static string GetTypeAndHashSuffix(string exePath)
if (assembly != null)
{
AssemblyName assemblyName = assembly.GetName();
Uri codeBase = new Uri(assembly.CodeBase);
Uri codeBase = new Uri(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, assemblyName.Name));

hash = IdentityHelper.GetNormalizedStrongNameHash(assemblyName);
if (hash != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal static string MachineConfigFilePath
{
if (s_machineConfigFilePath == null)
{
string directory = RuntimeEnvironment.GetRuntimeDirectory();
string directory = AppDomain.CurrentDomain.BaseDirectory;
s_machineConfigFilePath = Path.Combine(Path.Combine(directory, MachineConfigSubdirectory),
MachineConfigFilename);
}
Expand Down