title: Cefsharp randomly not initializing
body: <p>Cefsharp sometimes fails to init. The control stays blank, nothing happens. But as soon as I restart the program, it works. It's completely random, and it always gets fixed by restarting. </p>
  
  <p>Since it's completely random, I don't know how to handle this error, or even know what is causing it. </p>
  
  <p>I have some buttons over the Browser which load flawlessly, but the browser appears blank. </p>
  
  <p>I tried to put a breakpoint in this if</p>
  
  <pre><code>if (Browser == null)
      {
          Environment.Exit(0);
      }
  </code></pre>
  
  <p>on MetroWindow_Loaded event, yet it's not triggering, so the browser is not null, but something is failing to init. </p>
  
  <p>Any suggestions on how to deal with this bug?</p>
  
  <p>Thanks</p>
  
  <p>Edit:</p>
  
  <p>I load a static html which loads a google maps v3. This executes in the MetroWindow_Loaded event:</p>
  
  <pre><code>        var html = System.IO.File.ReadAllText(@".\Resources\Mapa.html");
          Browser.LoadHtml(html);
  </code></pre>
  
  <p>This is the XAML tag</p>
  
  <pre><code>&lt;wpf:ChromiumWebBrowser Grid.Column="0" Grid.Row="0"  Grid.ColumnSpan="2" Grid.RowSpan="2"  x:Name="Browser" ConsoleMessage="Browser_OnConsoleMessage" LoadingStateChanged="Browser_OnLoadingStateChanged"/&gt;
  </code></pre>
  
  <p>Edit2: so I executed manually these lines when the bug appeared:</p>
  
  <pre><code> var html = System.IO.File.ReadAllText(@".\Resources\Mapa.html");
          Browser.LoadHtml(html);
  </code></pre>
  
  <p>and the browser loaded so: </p>
  
  <p>Browser is not null and is not failing to initialize, but either 
  a) metroWindow_Loaded is not firing
  b) metroWindow_Loaded is firing "too soon" and therefore Browser.LoadHtml(html) not loading the HTML. </p>
  
  <p>is there a more appropiate event to run this code?</p>
  
  <p>Edit3: This is how MainWindow inits, maybe it's worth mentioning. </p>
  
  <pre><code>public MainWindow()
  {
      InitializeComponent();
      _mapaController = new MapaController(this);
      Browser.RegisterAsyncJsObject("boundAsync", _mapaController, BindingOptions.DefaultBinder);
      var login = new LoginView();
      var res = login.ShowDialog(); //this dialog waits for user input
      if (res != true) Environment.Exit(0);
  }
  </code></pre>