title: CSharp exception when trying to use Selenium grid
body: <p>I am receiving the following error when trying to launch my automation tests using selenium grid.</p>
  
  <p>I have the hub running after launching this command.</p>
  
  <p><strong>When I browse <a href="http://10.1.27.27:4441/grid/register" rel="nofollow noreferrer">http://10.1.27.27:4441/grid/register</a></strong></p>
  
  <p>I receive this error message:</p>
  
  <pre><code>HTTP ERROR 500
  Problem accessing /grid/register. Reason:
  Server Error
  Caused by:
  java.lang.IllegalStateException: Not a JSON Object: null
  at com.google.gson.JsonElement.getAsJsonObject(JsonElement.java:90)
  at org.openqa.grid.web.servlet.RegistrationServlet.process(RegistrationServlet.java:84)
  at org.openqa.grid.web.servlet.RegistrationServlet.doGet(RegistrationServlet.jav
  </code></pre>
  
  <p><strong>Command to start the hub</strong></p>
  
  <pre><code>C:\seleniumserver\java -jar selenium-server-standalone-3.4.0.jar -role hub -port 4441
  C:\seleniumserver\java -jar selenium-server-standalone-3.4.0.jar -role wd -hub http://localhost:4441/grid/register
  </code></pre>
  
  <p><strong>Code</strong></p>
  
  <pre><code>var capabilities = DesiredCapabilities.Chrome();
  capabilities.Platform = Platform.CurrentPlatform;
  IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4441/wd/hub"), capabilities);
  </code></pre>
  
  <p><strong>Error message received</strong></p>
  
  <pre><code>at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
  at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
  at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
  at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
  at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, ICapabilities desiredCapabilities)
  at Boden.Automation.Workflow.BodenMobileNavigation..ctor() in C:\Projects\UAT Automation\Dev\SourceCode\test.cs:line 43
  at test..ctor() in C:\Projects\UAT Automation\Dev\SourceCode\test.cs:line 21
  </code></pre>
  
  <p><strong>Log</strong></p>
  
  <p><a href="https://i.stack.imgur.com/teXpL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/teXpL.png" alt="Log "></a></p>
  
  <p><strong>Log 2</strong></p>
  
  <p><a href="https://i.stack.imgur.com/5TYJC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5TYJC.png" alt="node log"></a></p>
  
  <p><strong>Update</strong></p>
  
  <p>Here are my actions.  Open command prompt (as administrator), navigate to the selenium jar folder and execute this command</p>
  
  <pre><code>java -jar selenium-server-standalone-3.4.0.jar -role hub -port 4441
  </code></pre>
  
  <p><strong>The output from this command is here:</strong></p>
  
  <pre><code>C:\SeleniumGrid&gt;java -jar selenium-server-standalone-3.4.0.jar -role hub -port 4441
  14:40:34.811 INFO - Selenium build info: version: '3.4.0', revision: 'unknown'
  14:40:34.811 INFO - Launching Selenium Grid hub
  2017-08-03 14:40:35.252:INFO::main: Logging initialized @603ms to org.seleniumhq.jetty9.util.log.StdErrLog
  14:40:35.262 INFO - Will listen on 4441
  2017-08-03 14:40:35.299:INFO:osjs.Server:main: jetty-9.4.3.v20170317
  2017-08-03 14:40:35.322:INFO:osjs.session:main: DefaultSessionIdManager workerName=node0
  2017-08-03 14:40:35.322:INFO:osjs.session:main: No SessionScavenger set, using defaults
  2017-08-03 14:40:35.324:INFO:osjs.session:main: Scavenging every 600000ms
  2017-08-03 14:40:35.329:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@154b04f{/,null,AVAILABLE}
  2017-08-03 14:40:35.341:INFO:osjs.AbstractConnector:main: Started ServerConnector@13af739{HTTP/1.1,[http/1.1]}{0.0.0.0:4441}
  2017-08-03 14:40:35.341:INFO:osjs.Server:main: Started @692ms
  14:40:35.342 INFO - Nodes should register to 
  http://10.1.27.27:4441/grid/register/
  14:40:35.342 INFO - Selenium Grid hub is up and running
  </code></pre>
  
  <p>Then, I open a new command prompt (as administrator) and execute the following command in the selenium folder</p>
  
  <pre><code>java -jar selenium-server-standalone-3.4.0.jar -role wd -hub http://localhost:4441/grid/register
  </code></pre>
  
  <p><strong>The output from this command is here:</strong></p>
  
  <pre><code>C:\SeleniumGrid&gt;java -jar selenium-server-standalone-3.4.0.jar -role wd -hub http://localhost:4441/grid/register
  14:41:19.175 INFO - Selenium build info: version: '3.4.0', revision: 'unknown'
  14:41:19.175 INFO - Launching a Selenium Grid node
  2017-08-03 14:41:19.516:INFO::main: Logging initialized @505ms to org.seleniumhq.jetty9.util.log.StdErrLog
  14:41:19.563 INFO - Driver class not found: com.opera.core.systems.OperaDriver
  14:41:19.563 INFO - Driver provider com.opera.core.systems.OperaDriver 
  registration is skipped:Unable to create new instances on this machine.
  14:41:19.564 INFO - Driver class not found: com.opera.core.systems.OperaDriver
  14:41:19.564 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
  14:41:19.565 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped: registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform WIN8_1
  2017-08-03 14:41:19.592:INFO:osjs.Server:main: jetty-9.4.3.v20170317
  2017-08-03 14:41:19.613:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@10f1111{/,null,AVAILABLE}
  2017-08-03 14:41:19.625:INFO:osjs.AbstractConnector:main: Started ServerConnector@23e5ee{HTTP/1.1,[http/1.1]}{0.0.0.0:5555}
  2017-08-03 14:41:19.626:INFO:osjs.Server:main: Started @615ms
  14:41:19.626 INFO - Selenium Grid node is up and ready to register to the hub
  14:41:19.636 INFO - Starting auto registration thread. Will try to register every 5000 ms.
  14:41:19.636 INFO - Registering the node to the hub:http://localhost:4441/grid/register
  14:41:19.675 INFO - The node is registered to the hub and ready to use
  </code></pre>
  
  <p><strong>C# error (from running it within visual studio)</strong></p>
  
  <p>at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
     at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
     at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
     at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
     at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, ICapabilities desiredCapabilities)
     at ....ctor() in C:\Projects\UAT Automation\Dev\SourceCode...cs:line 38
     at ....ctor() in C:\Projects\UAT Automation\Dev\SourceCode...cs:line 21</p>
  
  <p><strong>This is the error I receive</strong></p>
  
  <p><a href="https://i.stack.imgur.com/TBRuN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TBRuN.png" alt="visual studio and command prompts screen shot"></a></p>