Skip to content

Developer settings aren't restored on app startup #5749

@tido64

Description

@tido64

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:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions