diff --git a/change/react-native-windows-2020-05-04-12-54-41-publiccustomredbox.json b/change/react-native-windows-2020-05-04-12-54-41-publiccustomredbox.json
new file mode 100644
index 00000000000..dc9e8030a2f
--- /dev/null
+++ b/change/react-native-windows-2020-05-04-12-54-41-publiccustomredbox.json
@@ -0,0 +1,8 @@
+{
+ "type": "prerelease",
+ "comment": "Expose ability for apps to provide their own RedBox implementation",
+ "packageName": "react-native-windows",
+ "email": "acoates@microsoft.com",
+ "dependentChangeType": "patch",
+ "date": "2020-05-04T19:54:41.414Z"
+}
diff --git a/packages/playground/windows/playground.sln b/packages/playground/windows/playground.sln
index 6c610df8452..62a9c082eae 100644
--- a/packages/playground/windows/playground.sln
+++ b/packages/playground/windows/playground.sln
@@ -43,6 +43,7 @@ EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
..\..\..\vnext\JSI\Shared\JSI.Shared.vcxitems*{0cc28589-39e4-4288-b162-97b959f8b843}*SharedItemsImports = 9
+ ..\..\..\vnext\ReactWindowsCore\ReactWindowsCore.vcxitems*{11c084a3-a57c-4296-a679-cac17b603144}*SharedItemsImports = 4
..\..\..\vnext\Shared\Shared.vcxitems*{2049dbe9-8d13-42c9-ae4b-413ae38fffd0}*SharedItemsImports = 9
..\..\..\vnext\Microsoft.ReactNative.SharedManaged\Microsoft.ReactNative.SharedManaged.projitems*{67a1076f-7790-4203-86ea-4402ccb5e782}*SharedItemsImports = 13
..\..\..\vnext\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{6b6aa847-b32f-41ac-9d3b-48a8cdfa8ade}*SharedItemsImports = 4
diff --git a/packages/scripts/formatFiles.js b/packages/scripts/formatFiles.js
index 86c16d088e0..7bce4725db7 100644
--- a/packages/scripts/formatFiles.js
+++ b/packages/scripts/formatFiles.js
@@ -35,6 +35,7 @@ function queryNoOpenFiles() {
if (opened) {
console.error('The following files have incorrect formatting:');
console.error(opened);
+ console.error('Running `yarn format` from the repo root should fix this.');
process.exit(2);
}
}
diff --git a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj
index 4558c0c563e..3b4340cec48 100644
--- a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj
+++ b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj
@@ -342,6 +342,10 @@
ReactInstanceSettings.idl
Code
+
+ RedBoxHandler.idl
+ Code
+
ReactNativeHost.idl
Code
@@ -503,6 +507,10 @@
ReactInstanceSettings.idl
Code
+
+ RedBoxHandler.idl
+ Code
+
ReactNativeHost.idl
Code
@@ -560,6 +568,9 @@
Designer
+
+ Designer
+
Designer
diff --git a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters
index f5cee04be05..de2019f2870 100644
--- a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters
+++ b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters
@@ -688,6 +688,7 @@
+
diff --git a/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp b/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp
index 957aca066f2..0218b9b075c 100644
--- a/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp
+++ b/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp
@@ -517,7 +517,7 @@ std::shared_ptr ReactInstanceWin::GetRedBoxHandler() noexcept {
return m_options.RedBoxHandler;
} else if (m_options.DeveloperSettings.IsDevModeEnabled) {
auto localWkReactHost = m_weakReactHost;
- return CreateRedBoxHandler(std::move(localWkReactHost), m_uiMessageThread.LoadWithLock());
+ return CreateDefaultRedBoxHandler(std::move(localWkReactHost));
} else {
return {};
}
diff --git a/vnext/Microsoft.ReactNative/ReactInstanceSettings.h b/vnext/Microsoft.ReactNative/ReactInstanceSettings.h
index daeb91102b9..1e828273511 100644
--- a/vnext/Microsoft.ReactNative/ReactInstanceSettings.h
+++ b/vnext/Microsoft.ReactNative/ReactInstanceSettings.h
@@ -80,6 +80,9 @@ struct ReactInstanceSettings : ReactInstanceSettingsT {
uint16_t DebuggerPort() noexcept;
void DebuggerPort(uint16_t value) noexcept;
+ IRedBoxHandler RedBoxHandler() noexcept;
+ void RedBoxHandler(IRedBoxHandler const &value) noexcept;
+
private:
IReactPropertyBag m_properties{ReactPropertyBagHelper::CreatePropertyBag()};
hstring m_mainComponentName{};
@@ -100,6 +103,7 @@ struct ReactInstanceSettings : ReactInstanceSettingsT {
hstring m_debugBundlePath{};
hstring m_bundleRootPath{};
uint16_t m_debuggerPort{9229};
+ IRedBoxHandler m_redBoxHandler{nullptr};
};
} // namespace winrt::Microsoft::ReactNative::implementation
@@ -264,4 +268,12 @@ inline void ReactInstanceSettings::DebuggerPort(uint16_t value) noexcept {
m_debuggerPort = value;
}
+inline IRedBoxHandler ReactInstanceSettings::RedBoxHandler() noexcept {
+ return m_redBoxHandler;
+}
+
+inline void ReactInstanceSettings::RedBoxHandler(IRedBoxHandler const &value) noexcept {
+ m_redBoxHandler = value;
+}
+
} // namespace winrt::Microsoft::ReactNative::implementation
diff --git a/vnext/Microsoft.ReactNative/ReactInstanceSettings.idl b/vnext/Microsoft.ReactNative/ReactInstanceSettings.idl
index 22887666ca3..f388e735f29 100644
--- a/vnext/Microsoft.ReactNative/ReactInstanceSettings.idl
+++ b/vnext/Microsoft.ReactNative/ReactInstanceSettings.idl
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
+import "RedBoxHandler.idl";
import "IReactPropertyBag.idl";
namespace Microsoft.ReactNative {
@@ -29,5 +30,6 @@ namespace Microsoft.ReactNative {
String DebugBundlePath { get; set; };
String BundleRootPath { get; set; };
UInt16 DebuggerPort { get; set; };
+ Microsoft.ReactNative.IRedBoxHandler RedBoxHandler { get; set; };
}
}
diff --git a/vnext/Microsoft.ReactNative/ReactNativeHost.cpp b/vnext/Microsoft.ReactNative/ReactNativeHost.cpp
index 6812a46bef3..a7a1c9f3c99 100644
--- a/vnext/Microsoft.ReactNative/ReactNativeHost.cpp
+++ b/vnext/Microsoft.ReactNative/ReactNativeHost.cpp
@@ -6,6 +6,7 @@
#include "ReactNativeHost.g.cpp"
#include "ReactPackageBuilder.h"
+#include "RedBox.h"
using namespace winrt;
using namespace Windows::Foundation::Collections;
@@ -78,6 +79,10 @@ void ReactNativeHost::ReloadInstance() noexcept {
legacySettings.UseWebDebugger = m_instanceSettings.UseWebDebugger();
legacySettings.DebuggerPort = m_instanceSettings.DebuggerPort();
+ if (m_instanceSettings.RedBoxHandler()) {
+ legacySettings.RedBoxHandler = std::move(Mso::React::CreateRedBoxHandler(m_instanceSettings.RedBoxHandler()));
+ }
+
Mso::React::ReactOptions reactOptions{};
reactOptions.Properties = m_instanceSettings.Properties();
reactOptions.DeveloperSettings.IsDevModeEnabled = legacySettings.EnableDeveloperMenu;
@@ -91,6 +96,7 @@ void ReactNativeHost::ReloadInstance() noexcept {
reactOptions.DeveloperSettings.DebugHost = legacySettings.DebugHost;
reactOptions.BundleRootPath = legacySettings.BundleRootPath;
reactOptions.DeveloperSettings.DebuggerPort = legacySettings.DebuggerPort;
+ reactOptions.RedBoxHandler = legacySettings.RedBoxHandler;
reactOptions.LegacySettings = std::move(legacySettings);
diff --git a/vnext/Microsoft.ReactNative/RedBox.cpp b/vnext/Microsoft.ReactNative/RedBox.cpp
index 0c1c327cb24..699454c743e 100644
--- a/vnext/Microsoft.ReactNative/RedBox.cpp
+++ b/vnext/Microsoft.ReactNative/RedBox.cpp
@@ -4,6 +4,7 @@
#include "RedBox.h"
#include
#include
+#include
#include
#include
#include
@@ -18,10 +19,10 @@ namespace Mso::React {
struct RedBox : public std::enable_shared_from_this {
RedBox(
- Mso::WeakPtr weakReactHost,
+ const Mso::WeakPtr &weakReactHost,
Mso::Functor &&onClosedCallback,
ErrorInfo &&errorInfo) noexcept
- : m_weakReactHost(std::move(weakReactHost)),
+ : m_weakReactHost(weakReactHost),
m_onClosedCallback(std::move(onClosedCallback)),
m_errorInfo(std::move(errorInfo)) {}
@@ -356,26 +357,22 @@ struct RedBox : public std::enable_shared_from_this {
/*
* This class is implemented such that the methods on IRedBoxHandler are thread safe.
*/
-struct RedBoxHandler : public std::enable_shared_from_this, IRedBoxHandler {
- RedBoxHandler(
- Mso::WeakPtr weakReactHost,
- std::shared_ptr uiMessageQueue) noexcept
- : m_weakReactHost(std::move(weakReactHost)), m_wkUIMessageQueue(std::move(uiMessageQueue)) {}
+struct DefaultRedBoxHandler : public std::enable_shared_from_this, IRedBoxHandler {
+ DefaultRedBoxHandler(Mso::WeakPtr &&weakReactHost) noexcept
+ : m_weakReactHost(std::move(weakReactHost)) {}
- ~RedBoxHandler() {
+ ~DefaultRedBoxHandler() {
// Hide any currently showing redboxes
std::vector> redboxes;
{
std::scoped_lock lock{m_lockRedBox};
std::swap(m_redboxes, redboxes);
}
- if (auto uiQueue = m_wkUIMessageQueue.lock()) {
- uiQueue->runOnQueue([redboxes = std::move(redboxes)]() {
- for (const auto redbox : redboxes) {
- redbox->Dismiss();
- }
- });
- }
+ Mso::DispatchQueue::MainUIQueue().Post([redboxes = std::move(redboxes)]() {
+ for (const auto redbox : redboxes) {
+ redbox->Dismiss();
+ }
+ });
}
virtual void showNewError(ErrorInfo &&info, ErrorType /*exceptionType*/) override {
@@ -394,7 +391,7 @@ struct RedBoxHandler : public std::enable_shared_from_this, IRedB
showTopJSError();
}
- virtual bool isDevSupportEnabled() override {
+ virtual bool isDevSupportEnabled() const override {
if (auto reactHost = m_weakReactHost.GetStrongPtr()) {
return reactHost->Options().DeveloperSettings.IsDevModeEnabled;
}
@@ -414,28 +411,26 @@ struct RedBoxHandler : public std::enable_shared_from_this, IRedB
}
}
if (redbox) {
- if (auto uiQueue = m_wkUIMessageQueue.lock()) {
- uiQueue->runOnQueue([redboxCaptured = std::move(redbox), errorInfo = std::move(info)]() {
- redboxCaptured->UpdateError(std::move(errorInfo));
- });
- }
+ Mso::DispatchQueue::MainUIQueue().Post([redboxCaptured = std::move(redbox), errorInfo = std::move(info)]() {
+ redboxCaptured->UpdateError(std::move(errorInfo));
+ });
}
}
virtual void dismissRedbox() override {
- if (auto uiQueue = m_wkUIMessageQueue.lock()) {
- uiQueue->runOnQueue([&]() {
- std::scoped_lock lock{m_lockRedBox};
- if (!m_redboxes.empty())
- m_redboxes[0]->Dismiss();
- });
- }
+ Mso::DispatchQueue::MainUIQueue().Post([wkthis = std::weak_ptr(shared_from_this())]() {
+ if (auto pthis = wkthis.lock()) {
+ std::scoped_lock lock{pthis->m_lockRedBox};
+ if (!pthis->m_redboxes.empty())
+ pthis->m_redboxes[0]->Dismiss();
+ }
+ });
}
private:
// When notified by a redbox that its been dismisssed
void onDismissedCallback(uint32_t id) noexcept {
- // Save a local ref, so if we are removing the last redbox which could hold the last ref to the RedBoxHandler
+ // Save a local ref, so if we are removing the last redbox which could hold the last ref to the DefaultRedBoxHandler
// We ensure that we exit the mutex before the handler is destroyed.
std::shared_ptr redbox;
{
@@ -463,25 +458,114 @@ struct RedBoxHandler : public std::enable_shared_from_this, IRedB
}
}
- if (auto uiQueue = m_wkUIMessageQueue.lock()) {
- if (m_showingRedBox || !redbox) // Only show one redbox at a time
- return;
- m_showingRedBox = true;
- uiQueue->runOnQueue([redboxCaptured = std::move(redbox)]() { redboxCaptured->ShowNewJSError(); });
- }
+ if (m_showingRedBox || !redbox) // Only show one redbox at a time
+ return;
+ m_showingRedBox = true;
+
+ Mso::DispatchQueue::MainUIQueue().Post(
+ [redboxCaptured = std::move(redbox)]() { redboxCaptured->ShowNewJSError(); });
}
bool m_showingRedBox = false; // Access from UI Thread only
std::mutex m_lockRedBox;
std::vector> m_redboxes; // Protected by m_lockRedBox
const Mso::WeakPtr m_weakReactHost;
- const std::weak_ptr m_wkUIMessageQueue;
+};
+
+struct RedBoxErrorFrameInfo
+ : public winrt::implements {
+ RedBoxErrorFrameInfo(Mso::React::ErrorFrameInfo &&errorFrameInfo) : m_frame(std::move(errorFrameInfo)) {}
+
+ winrt::hstring File() const noexcept {
+ return ::Microsoft::Common::Unicode::Utf8ToUtf16(m_frame.File).c_str();
+ }
+
+ winrt::hstring Method() const noexcept {
+ return ::Microsoft::Common::Unicode::Utf8ToUtf16(m_frame.Method).c_str();
+ }
+
+ uint32_t Line() const noexcept {
+ return m_frame.Line;
+ }
+
+ uint32_t Column() const noexcept {
+ return m_frame.Column;
+ }
+
+ private:
+ Mso::React::ErrorFrameInfo m_frame;
+};
+
+struct RedBoxErrorInfo : public winrt::implements {
+ RedBoxErrorInfo(Mso::React::ErrorInfo &&errorInfo) : m_errorInfo(std::move(errorInfo)) {}
+
+ winrt::hstring Message() const noexcept {
+ return ::Microsoft::Common::Unicode::Utf8ToUtf16(m_errorInfo.Message).c_str();
+ }
+
+ uint32_t Id() const noexcept {
+ return m_errorInfo.Id;
+ }
+
+ winrt::Windows::Foundation::Collections::IVectorView
+ Callstack() noexcept {
+ if (!m_callstack) {
+ m_callstack = winrt::single_threaded_vector();
+ for (auto frame : m_errorInfo.Callstack) {
+ m_callstack.Append(winrt::make(std::move(frame)));
+ }
+ }
+
+ return m_callstack.GetView();
+ }
+
+ private:
+ winrt::Windows::Foundation::Collections::IVector m_callstack{
+ nullptr};
+
+ Mso::React::ErrorInfo m_errorInfo;
+};
+
+struct RedBoxHandler : public Mso::React::IRedBoxHandler {
+ RedBoxHandler(winrt::Microsoft::ReactNative::IRedBoxHandler const &redBoxHandler) : m_redBoxHandler(redBoxHandler) {}
+
+ static_assert(
+ static_cast(Mso::React::ErrorType::JSFatal) ==
+ static_cast(winrt::Microsoft::ReactNative::RedBoxErrorType::JavaScriptFatal));
+ static_assert(
+ static_cast(Mso::React::ErrorType::JSSoft) ==
+ static_cast(winrt::Microsoft::ReactNative::RedBoxErrorType::JavaScriptSoft));
+ static_assert(
+ static_cast(Mso::React::ErrorType::Native) ==
+ static_cast(winrt::Microsoft::ReactNative::RedBoxErrorType::Native));
+
+ virtual void showNewError(Mso::React::ErrorInfo &&info, Mso::React::ErrorType errorType) override {
+ m_redBoxHandler.ShowNewError(
+ winrt::make(std::move(info)),
+ static_cast(static_cast(errorType)));
+ }
+ virtual bool isDevSupportEnabled() const override {
+ return m_redBoxHandler.IsDevSupportEnabled();
+ }
+ virtual void updateError(Mso::React::ErrorInfo &&info) override {
+ m_redBoxHandler.UpdateError(winrt::make(std::move(info)));
+ }
+
+ virtual void dismissRedbox() override {
+ m_redBoxHandler.DismissRedBox();
+ }
+
+ private:
+ winrt::Microsoft::ReactNative::IRedBoxHandler m_redBoxHandler;
};
std::shared_ptr CreateRedBoxHandler(
- Mso::WeakPtr &&weakReactHost,
- std::shared_ptr &&uiMessageQueue) noexcept {
- return std::make_shared(std::move(weakReactHost), std::move(uiMessageQueue));
+ winrt::Microsoft::ReactNative::IRedBoxHandler const &redBoxHandler) noexcept {
+ return std::make_shared(redBoxHandler);
+}
+
+std::shared_ptr CreateDefaultRedBoxHandler(Mso::WeakPtr &&weakReactHost) noexcept {
+ return std::make_shared(std::move(weakReactHost));
}
} // namespace Mso::React
diff --git a/vnext/Microsoft.ReactNative/RedBox.h b/vnext/Microsoft.ReactNative/RedBox.h
index 8be0393b921..0a14590aaea 100644
--- a/vnext/Microsoft.ReactNative/RedBox.h
+++ b/vnext/Microsoft.ReactNative/RedBox.h
@@ -2,13 +2,14 @@
// Licensed under the MIT License.
#pragma once
#include
+#include "IRedBoxHandler.h"
#include "ReactHost/React.h"
-#include "RedBoxHandler.h"
namespace Mso::React {
std::shared_ptr CreateRedBoxHandler(
- Mso::WeakPtr &&weakReactHost,
- std::shared_ptr &&uiMessageQueue) noexcept;
+ winrt::Microsoft::ReactNative::IRedBoxHandler const &redBoxHandler) noexcept;
+
+std::shared_ptr CreateDefaultRedBoxHandler(Mso::WeakPtr &&weakReactHost) noexcept;
} // namespace Mso::React
diff --git a/vnext/Microsoft.ReactNative/RedBoxHandler.cpp b/vnext/Microsoft.ReactNative/RedBoxHandler.cpp
new file mode 100644
index 00000000000..945bece5241
--- /dev/null
+++ b/vnext/Microsoft.ReactNative/RedBoxHandler.cpp
@@ -0,0 +1,63 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+#include "pch.h"
+#include "RedBoxHandler.h"
+#if __has_include("RedBoxHelper.g.cpp")
+#include "RedBoxHelper.g.cpp"
+#endif
+
+#include
+#include
+#include
+
+namespace winrt::Microsoft::ReactNative::implementation {
+
+Mso::React::ErrorInfo CreateErrorInfo(const IRedBoxErrorInfo &info) {
+ Mso::React::ErrorInfo ei;
+ ei.Id = info.Id();
+ ei.Message = ::Microsoft::Common::Unicode::Utf16ToUtf8(info.Message());
+ for (const auto &frame : info.Callstack()) {
+ Mso::React::ErrorFrameInfo efi;
+ efi.Method = ::Microsoft::Common::Unicode::Utf16ToUtf8(frame.Method());
+ efi.File = ::Microsoft::Common::Unicode::Utf16ToUtf8(frame.File());
+ efi.Line = frame.Line();
+ efi.Column = frame.Column();
+ ei.Callstack.push_back(std::move(efi));
+ }
+ return ei;
+}
+
+struct DefaultRedBoxHandler : winrt::implements {
+ DefaultRedBoxHandler(winrt::Microsoft::ReactNative::ReactNativeHost const &host) noexcept {
+ auto hostImpl = winrt::get_self(host);
+ Mso::WeakPtr wkHost(hostImpl->ReactHost());
+ m_redBoxHandler = Mso::React::CreateDefaultRedBoxHandler(std::move(wkHost));
+ }
+
+ void ShowNewError(IRedBoxErrorInfo const &info, RedBoxErrorType type) noexcept {
+ m_redBoxHandler->showNewError(
+ CreateErrorInfo(info), static_cast(static_cast(type)));
+ }
+
+ bool IsDevSupportEnabled() noexcept {
+ return m_redBoxHandler->isDevSupportEnabled();
+ }
+
+ void UpdateError(IRedBoxErrorInfo const &info) noexcept {
+ m_redBoxHandler->updateError(std::move(CreateErrorInfo(info)));
+ }
+
+ void DismissRedBox() noexcept {
+ m_redBoxHandler->dismissRedbox();
+ }
+
+ private:
+ std::shared_ptr m_redBoxHandler;
+};
+
+IRedBoxHandler RedBoxHelper::CreateDefaultHandler(winrt::Microsoft::ReactNative::ReactNativeHost const &host) noexcept {
+ return winrt::make(host);
+}
+
+} // namespace winrt::Microsoft::ReactNative::implementation
diff --git a/vnext/Microsoft.ReactNative/RedBoxHandler.h b/vnext/Microsoft.ReactNative/RedBoxHandler.h
new file mode 100644
index 00000000000..e8aa4b1f6ac
--- /dev/null
+++ b/vnext/Microsoft.ReactNative/RedBoxHandler.h
@@ -0,0 +1,26 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+#pragma once
+
+#include "RedBoxHelper.g.h"
+
+namespace Mso::React {
+struct IRedBoxHandler;
+}
+
+namespace winrt::Microsoft::ReactNative::implementation {
+
+struct RedBoxHelper : RedBoxHelperT {
+ RedBoxHelper() = default;
+
+ static IRedBoxHandler CreateDefaultHandler(winrt::Microsoft::ReactNative::ReactNativeHost const &host) noexcept;
+};
+
+} // namespace winrt::Microsoft::ReactNative::implementation
+
+namespace winrt::Microsoft::ReactNative::factory_implementation {
+
+struct RedBoxHelper : RedBoxHelperT {};
+
+} // namespace winrt::Microsoft::ReactNative::factory_implementation
diff --git a/vnext/Microsoft.ReactNative/RedBoxHandler.idl b/vnext/Microsoft.ReactNative/RedBoxHandler.idl
new file mode 100644
index 00000000000..0092086437e
--- /dev/null
+++ b/vnext/Microsoft.ReactNative/RedBoxHandler.idl
@@ -0,0 +1,43 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+import "ReactNativeHost.idl";
+
+namespace Microsoft.ReactNative {
+
+ enum RedBoxErrorType {
+ JavaScriptFatal, // A JS Exception was thrown or otherwise fatal error
+ JavaScriptSoft, // An error coming from JS that isn't fatal, such as console.error
+ Native,
+ };
+
+ [webhosthidden] interface IRedBoxErrorFrameInfo {
+ String File { get; };
+ String Method { get; };
+ UInt32 Line { get; };
+ UInt32 Column { get; };
+ }
+
+ [webhosthidden] interface IRedBoxErrorInfo {
+ String Message { get; };
+ UInt32 Id { get; };
+ IVectorView Callstack { get; };
+ }
+
+ [webhosthidden]
+ interface IRedBoxHandler
+ {
+ void ShowNewError(IRedBoxErrorInfo info, RedBoxErrorType type);
+ Boolean IsDevSupportEnabled { get; };
+ void UpdateError(IRedBoxErrorInfo info);
+ void DismissRedBox();
+ }
+
+ [webhosthidden]
+ [default_interface]
+ runtimeclass RedBoxHelper {
+ RedBoxHelper();
+ static IRedBoxHandler CreateDefaultHandler(Microsoft.ReactNative.ReactNativeHost host);
+ }
+
+}
diff --git a/vnext/ReactUWP/Base/UwpReactInstance.cpp b/vnext/ReactUWP/Base/UwpReactInstance.cpp
index 8fbabcb20ce..ce74a02918b 100644
--- a/vnext/ReactUWP/Base/UwpReactInstance.cpp
+++ b/vnext/ReactUWP/Base/UwpReactInstance.cpp
@@ -51,7 +51,7 @@
#include "V8JSIRuntimeHolder.h"
#endif // USE_V8
-#include
+#include
#include
#include "ChakraRuntimeHolder.h"
@@ -87,7 +87,7 @@ struct UwpReactRedBoxHandler : Mso::React::IRedBoxHandler {
Microsoft::Common::Unicode::Utf8ToUtf16(ss.str().c_str()), L"RedBox Error");
dlg.ShowAsync();
}
- virtual bool isDevSupportEnabled() override {
+ virtual bool isDevSupportEnabled() const override {
return true;
}
virtual void updateError(Mso::React::ErrorInfo &&) override {}
diff --git a/vnext/ReactWindowsCore/DevSettings.h b/vnext/ReactWindowsCore/DevSettings.h
index 44808a5e4d9..061ea4259c4 100644
--- a/vnext/ReactWindowsCore/DevSettings.h
+++ b/vnext/ReactWindowsCore/DevSettings.h
@@ -5,7 +5,7 @@
#include "Logging.h"
#include "MemoryTracker.h"
-#include
+#include
#include
#include