title: sharepoint javascript collection not initialized error
body: <p>I have a strange problem. It occurs totally randomly, I have no idea why and in what circumstances it comes.</p>
  
  <p>Details: I want to get the members of a Group with the <code>executeQueryAsync</code> function. In the callback the <code>userEnumerator = users.getEnumerator();</code> row throws this exception:
  <strong>The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.</strong></p>
  
  <p>There is no other async code running. I dont know if this important, but this only happens if this is running at page load.</p>
  
  <p>I insert this code with an <code>XML Viewer</code> webpart.</p>
  
  <pre><code>    var ctx = SP.ClientContext.get_current(),
  
      groups = ctx.get_web().get_siteGroups(),
      group = groups.getById(6),
      users = group.get_users();
  
      ctx.load(group);
      ctx.load(users);
  
      ctx.executeQueryAsync(function () {
          var userEnumerator,
              user;
  
           $("#members-select").empty();
  
           userEnumerator = users.getEnumerator();
           while (userEnumerator.moveNext()) {
                user = userEnumerator.get_current();
                $("#members-select").append('&lt;option&gt;' + user.get_title() + '&lt;/option&gt;');
            }
      });
  </code></pre>
  
  <p>Thanks, if anyone knows and shares any information about this.
  I saw <a href="https://stackoverflow.com/questions/15022963/ecma-script-error-the-collection-has-not-been-initialized">this</a> question as well. </p>