diff --git a/src/mono/mono.proj b/src/mono/mono.proj
index 480f9e15048390..8bfbb710823937 100644
--- a/src/mono/mono.proj
+++ b/src/mono/mono.proj
@@ -818,8 +818,8 @@ JS_ENGINES = [NODE_JS]
<_LibClang Include="$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/lib/libclang.so" Condition=" Exists('$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/lib/libclang.so') "/>
- <_LibClang Include="$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/lib64/libclang.so.*" Condition=" '$(_LibClang)' == '' "/>
- <_LibClang Include="/usr/local/lib/libclang.so" Condition="'$(_LibClang)' == ''" />
+ <_LibClang Include="$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/lib64/libclang.so.*" Condition=" '@(_LibClang)' == '' "/>
+ <_LibClang Include="/usr/local/lib/libclang.so" Condition="'@(_LibClang)' == ''" />
true
diff --git a/src/native/corehost/hostmisc/pal.windows.cpp b/src/native/corehost/hostmisc/pal.windows.cpp
index 3a3db968b5bde4..3479c72aced1de 100644
--- a/src/native/corehost/hostmisc/pal.windows.cpp
+++ b/src/native/corehost/hostmisc/pal.windows.cpp
@@ -884,8 +884,12 @@ bool pal::realpath(pal::string_t* path, bool skip_error_logging)
}
}
- // Remove the \\?\ prefix, unless it is necessary or was already there
- if (LongFile::IsExtended(str) && !LongFile::IsExtended(*path) &&
+ // Remove the UNC extended prefix (\\?\UNC\) or extended prefix (\\?\) unless it is necessary or was already there
+ if (LongFile::IsUNCExtended(str) && !LongFile::IsUNCExtended(*path) && str.length() < MAX_PATH)
+ {
+ str.replace(0, LongFile::UNCExtendedPathPrefix.size(), LongFile::UNCPathPrefix);
+ }
+ else if (LongFile::IsExtended(str) && !LongFile::IsExtended(*path) &&
!LongFile::ShouldNormalize(str.substr(LongFile::ExtendedPrefix.size())))
{
str.erase(0, LongFile::ExtendedPrefix.size());