title: MonoDroid : Encoding.ASCII.GetString failing
body: <p>Intermittently, Encoding.ASCII.GetString call fails with an exception that escapes all the catch blocks in place and freezes the app. </p>
  
  <pre><code>private string ExecuteRequest(Uri url, KeyValuePair&lt;string, string&gt;[] postItems = null)
  {
      var data = new byte[0];
      var response = new byte[0];
      using (var client = new WebClient())
      {
          if (postItems != null &amp;&amp; postItems.Count() &gt; 0)
          {
              string dataString = string.Join("&amp;", postItems.Select(
                                      item =&gt; string.Format("{0}={1}", item.Key, item.Value)).ToArray());
              data = new ASCIIEncoding().GetBytes(dataString);
          }
          response = client.UploadData(url, "POST", data);
          Android.Util.Log.Info("info", "response from the post received. about to get string");
          client.Dispose();
      }
      try
      {
          return Encoding.ASCII.GetString(response);
      }
      catch (Exception ex)
      {
          Android.Util.Log.Info("info", 
              "Encoding.ASCII.GetString Exception : {0}, {1}", ex.Message, ex.StackTrace);
          throw new ApplicationException("UnRecoverable. Abort");
      }            
  }
  </code></pre>
  
  <p>StackTrace I get is</p>
  
  <pre><code>I/sssvida (10960): response from the post received. about to get string
  I/mono    (10960): Stacktrace:
  I/mono    (10960):
  I/mono    (10960):   at System.Text.ASCIIEncoding.GetString (byte[],int,int) &lt;0x000cb&gt;
  I/mono    (10960):   at System.Text.Encoding.GetString (byte[]) &lt;0x00037&gt;
  I/mono    (10960):   at ServiceRequest.ExecuteRequest (System.Uri,System.Collections.Generic.KeyValuePair`2&lt;string, string&gt;[]) &lt;0x0026b&gt;
  </code></pre>
  
  <p>Intermitently, I am getting an unusal stacktrace shown below</p>
  
  <pre><code>I/mono    ( 9817): Stacktrace:
  I/mono    ( 9817):
  F/        ( 9817): * Assertion at ../../../../mono/mini/mini-exceptions.c:472, condition `class' not met
  D/dalvikvm(  220): GC_EXPLICIT freed 1K, 35% free 17547K/26759K, paused 3ms+3ms
  </code></pre>
  
  <p>The response is json data that can range between 1 - 4 mb.</p>
  
  <p>Please help. Thanks!!!!</p>
  
  <p><strong>Edit 2</strong> : 
  I updated the code to use UploadString instead of UploadData and intermittently I get this :</p>
  
  <pre><code>I/mono    (15065): Stacktrace:
  I/mono    (15065):
  I/mono    (15065):   at string.CreateString (char[]) &lt;0x0004b&gt;
  I/mono    (15065):   at (wrapper managed-to-managed) string..ctor (char[]) &lt;0xffffffff&gt;
  I/mono    (15065):   at System.Text.Encoding.GetString (byte[],int,int) &lt;0x00043&gt;
  I/mono    (15065):   at System.Text.UTF8Encoding.GetString (byte[],int,int) &lt;0x0002b&gt;
  I/mono    (15065):   at System.Text.Encoding.GetString (byte[]) &lt;0x00037&gt;
  I/mono    (15065):   at System.Net.WebClient.UploadString (System.Uri,string,string) &lt;0x0007f&gt;
  I/mono    (15065):   at (wrapper remoting-invoke-with-check) System.Net.WebClient.UploadString (System.Uri,string,string) &lt;0xffffffff&gt;
  </code></pre>