Skip to content

Commit d3d51b8

Browse files
authored
Fix remote debugging with web debugging in Playground. (#5327)
* Allow setting debug host as a command line argument in Playground. * Fix namespace issue and rename debugHost to something more appropriate. * Align variable name with naming convention and remove unused variable.
1 parent 1429782 commit d3d51b8

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

packages/playground/windows/playground/MainPage.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ void MainPage::OnLoadClick(
5454
host.InstanceSettings().DebuggerBreakOnNextLine(x_BreakOnFirstLineCheckBox().IsChecked().GetBoolean());
5555
host.InstanceSettings().UseFastRefresh(x_UseFastRefreshCheckBox().IsChecked().GetBoolean());
5656
host.InstanceSettings().DebuggerPort(static_cast<uint16_t>(std::stoi(std::wstring(x_DebuggerPort().Text()))));
57+
if (!m_bundlerHostname.empty()) {
58+
host.InstanceSettings().DebugHost(m_bundlerHostname);
59+
}
5760

5861
// Nudge the ReactNativeHost to create the instance and wrapping context
5962
host.ReloadInstance();
@@ -73,6 +76,10 @@ void winrt::playground::implementation::MainPage::x_entryPointCombo_SelectionCha
7376
}
7477
}
7578

79+
void MainPage::OnNavigatedTo(xaml::Navigation::NavigationEventArgs const &e) {
80+
m_bundlerHostname = unbox_value<hstring>(e.Parameter());
81+
}
82+
7683
Microsoft::ReactNative::ReactNativeHost MainPage::Host() noexcept {
7784
return Application::Current().as<App>()->Host();
7885
}

packages/playground/windows/playground/MainPage.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ struct MainPage : MainPageT<MainPage> {
1616
Microsoft::ReactNative::ReactInstanceSettings m_instanceSettings;
1717
Windows::Foundation::Collections::IVector<Microsoft::ReactNative::IReactPackageProvider> m_packageProviders;
1818

19-
bool m_useWebDebugger{false};
19+
winrt::hstring m_bundlerHostname;
2020

2121
public:
2222
void x_entryPointCombo_SelectionChanged(
2323
winrt::Windows::Foundation::IInspectable const &sender,
2424
xaml::Controls::SelectionChangedEventArgs const &e);
25+
void OnNavigatedTo(xaml::Navigation::NavigationEventArgs const &e);
2526
};
2627

2728
} // namespace winrt::playground::implementation

packages/playground/windows/playground/Package.appxmanifest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,6 @@
4545

4646
<Capabilities>
4747
<Capability Name="internetClient" />
48+
<Capability Name="privateNetworkClientServer"/>
4849
</Capabilities>
4950
</Package>

0 commit comments

Comments
 (0)