Do not use copy-on-write on windows (#59194)
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Fri, 17 Sep 2021 12:55:06 +0000 (06:55 -0600)
committerGitHub <noreply@github.com>
Fri, 17 Sep 2021 12:55:06 +0000 (06:55 -0600)
Co-authored-by: vsadov <8218165+VSadov@users.noreply.github.com>
src/native/corehost/bundle/info.cpp

index 4d58a00..fd4a7d3 100644 (file)
@@ -108,7 +108,14 @@ char* info_t::config_t::map(const pal::string_t& path, const location_t* &locati
     // * There is no performance limitation due to a larger sized mapping, since we actually only read the pages with relevant contents.
     // * Files that are too large to be mapped (ex: that exhaust 32-bit virtual address space) are not supported. 
 
+#ifdef _WIN32
+    // Since we can't use in-situ parsing on Windows, as JSON data is encoded in
+    // UTF-8 and the host expects wide strings.
+    // We do not need COW and read-only mapping will be enough.
+    char* addr = (char*)pal::mmap_read(app->m_bundle_path);
+#else // _WIN32
     char* addr = (char*)pal::mmap_copy_on_write(app->m_bundle_path);
+#endif // _WIN32
     if (addr == nullptr)
     {
         trace::error(_X("Failure processing application bundle."));