Add additional debug logging for startSurface crashes

Summary:
There are a very, very small number of crashes in production that are hitting this line. I would like to understand what the existing tag ID is (perhaps it's eqal to the ID being set, which would indicate "double-start"). If not, it indicates that fragments are being reused somewhere, or something else odd is going on with lifecycles.

Changelog: [Internal]

Reviewed By: ejanzer

Differential Revision: D24953785

fbshipit-source-id: 079c86cdb571749662cca46feeaebdd6cb1281f4
This commit is contained in:
Joshua Gross
2020-11-13 21:53:36 -08:00
committed by Facebook GitHub Bot
parent 23def0f8f0
commit 66e536739e
@@ -103,6 +103,11 @@ public class MountingManager {
@ThreadConfined(UI)
public void addRootView(int reactRootTag, @NonNull View rootView) {
if (rootView.getId() != View.NO_ID) {
FLog.e(
TAG,
"Trying to add RootTag to RootView that already has a tag: existing tag: [%d] new tag: [%d]",
rootView.getId(),
reactRootTag);
throw new IllegalViewOperationException(
"Trying to add a root view with an explicit id already set. React Native uses "
+ "the id field to track react tags and will overwrite this field. If that is fine, "