diff --git a/ReactWindows/ReactNative.Net46/ReactPage.cs b/ReactWindows/ReactNative.Net46/ReactPage.cs index d8a42d148c1..61a78b56343 100644 --- a/ReactWindows/ReactNative.Net46/ReactPage.cs +++ b/ReactWindows/ReactNative.Net46/ReactPage.cs @@ -223,14 +223,19 @@ private void ApplyArguments(string[] arguments) return; } - if (arguments.Length % 2 != 0) + var index = Array.IndexOf(arguments, "remoteDebugging"); + if (index < 0) { - throw new ArgumentException("Expected even number of arguments.", nameof(arguments)); + return; } - var index = Array.IndexOf(arguments, "remoteDebugging"); - var isRemoteDebuggingEnabled = default(bool); - if (index % 2 == 0 && bool.TryParse(arguments[index + 1], out isRemoteDebuggingEnabled)) + if (arguments.Length <= index + 1) + { + throw new ArgumentException("Expected value for remoteDebugging argument.", nameof(arguments)); + } + + bool isRemoteDebuggingEnabled; + if (bool.TryParse(arguments[index + 1], out isRemoteDebuggingEnabled)) { ReactInstanceManager.DevSupportManager.IsRemoteDebuggingEnabled = isRemoteDebuggingEnabled; } diff --git a/ReactWindows/ReactNative/ReactPage.cs b/ReactWindows/ReactNative/ReactPage.cs index 57e8cd8fadf..00b9ba45ef0 100644 --- a/ReactWindows/ReactNative/ReactPage.cs +++ b/ReactWindows/ReactNative/ReactPage.cs @@ -203,14 +203,20 @@ private void ApplyArguments(string arguments) if (!string.IsNullOrEmpty(arguments)) { var args = arguments.Split(','); - if (args.Length % 2 != 0) + + var index = Array.IndexOf(args, "remoteDebugging"); + if (index < 0) { - throw new ArgumentException("Expected even number of arguments.", nameof(arguments)); + return; } - var index = Array.IndexOf(args, "remoteDebugging"); - var isRemoteDebuggingEnabled = default(bool); - if (index % 2 == 0 && bool.TryParse(args[index + 1], out isRemoteDebuggingEnabled)) + if (args.Length <= index + 1) + { + throw new ArgumentException("Expected value for remoteDebugging argument.", nameof(arguments)); + } + + bool isRemoteDebuggingEnabled; + if (bool.TryParse(args[index + 1], out isRemoteDebuggingEnabled)) { _reactInstanceManager.DevSupportManager.IsRemoteDebuggingEnabled = isRemoteDebuggingEnabled; }