microsoft / microsoft/react-native-windows

Developer settings aren't restored on app startup

Open
#5,749 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area: Developer Experience bug Needs: Dev Design Workstream: Developer Experience
Dominant language
C++
Stars
17.3k
Forks
1.2k
Avg merge
1d 13h
Merged PRs (30d)
33

Description

Developer settings are not restored on app startup like on other platforms. This can be annoying for developers since they have to setup their work flow on every startup, e.g. disabling remote debugging or enabling direct debugging.

Environment

  1. npx react-native --version: 4.10.1
  2. npx react-native run-windows --info:
      System:
        OS: Windows 10 10.0.18362
        CPU: (4) x64 Intel(R) Core(TM) i5-4690K CPU @ 3.50GHz
        Memory: 6.09 GB / 15.45 GB
      Binaries:
        Node: 12.18.3 - ~\scoop\apps\nodejs-lts\current\node.EXE
        Yarn: 1.22.4 - ~\scoop\apps\yarn\current\Yarn\bin\yarn.CMD
        npm: 6.14.6 - ~\source\repos\react-native-test-app\node_modules\.bin\npm.CMD
      npmPackages:
        @react-native-community/cli: ^4.5.1 => 4.10.1
        react: 16.11.0 => 16.11.0
        react-native: 0.62.2 => 0.62.2
        react-native-windows: 0.62.2 => 0.62.2
      Installed UWP SDKs:
        10.0.18362.0
    
  3. reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock
        AllowDevelopmentWithoutDevLicense    REG_DWORD    0x1
        AllowAllTrustedApps    REG_DWORD    0x1
    
  • Target Platform Version(s): 10.0.18362
  • Target Device(s): Desktop
  • Visual Studio Version: Community 2019
  • Build Configuration: Debug

Steps To Reproduce

  1. Press Ctrl+Shift+D and enable direct debugging
  2. Restart the app

Observe that remote debugging has been re-enabled.

Expected Results

Developer settings should be restored on app restart.

Snack, code example, screenshot, or link to a repository:

https://github.com/microsoft/react-native-test-app/tree/tido/rn-62

  1. Apply the patch below
  2. Run yarn in /example
  3. Run yarn start:windows in /example
  4. Open another terminal and run yarn in project root
  5. Open /windows/ReactTestApp.sln
diff --git a/windows/ReactTestApp/ReactInstance.cpp b/windows/ReactTestApp/ReactInstance.cpp
index 0910672..c5bf878 100644
--- a/windows/ReactTestApp/ReactInstance.cpp
+++ b/windows/ReactTestApp/ReactInstance.cpp
@@ -15,9 +15,9 @@ namespace ReactTestApp
     void ReactInstance::LoadJSBundleFrom(JSBundleSource source)
     {
         auto instanceSettings = reactNativeHost_.InstanceSettings();
-        instanceSettings.UseLiveReload(source == JSBundleSource::DevServer);
-        instanceSettings.UseWebDebugger(source == JSBundleSource::DevServer);
-        instanceSettings.UseFastRefresh(source == JSBundleSource::DevServer);
+        //instanceSettings.UseLiveReload(source == JSBundleSource::DevServer);
+        //instanceSettings.UseWebDebugger(source == JSBundleSource::DevServer);
+        //instanceSettings.UseFastRefresh(source == JSBundleSource::DevServer);

         switch (source) {
             case JSBundleSource::DevServer:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with windows/ReactTestApp/ReactInstance.cpp and the LoadJSBundleFrom method, then follow the issue's Windows reproduction steps from /example. Compare startup behavior with the developer settings changed through Ctrl+Shift+D; done means those settings, including direct or remote debugging choices, remain restored after restarting the app.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, react-native
Domain
desktop, developer-experience
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.