title: System.ArgumentException: Value does not fall within the expected range
body: <p>I am working on compactframework c# vs 2005.
  My PDA device is Pocket pC 2003 device.</p>
  
  <p>I installed my application and running successfully in my PDA device.when i released the project to client and when he deployed and start running the application, he is getting an error</p>
  
  <p>"System.ArgumentException: Value does not fall within the expected range.
  at System.Text.ASCIIEncoding.GetBytes()".</p>
  
  <p>Stack Trace is here</p>
  
  <pre><code>Exception: System.ArgumentException: Value does not fall within the expected range.
  at System.Text.ASCIIEncoding.GetBytes()
  at  BinaryEncoder.EncodeVariableString()
  at DataHolder.encodeValue()
  at  UpdateInformation.encode()
  at DataHolder.encodeValue()
  at LogonRequest.encode()
  at MessageFactory.getRequestMsg()
  at MessageFactory.getRequestMsg()
  at LogonManager.logon()
  at doLogon()
  at frmLogin.btnNext_Click()
  </code></pre>
  
  <blockquote>
    <p>public static int EncodeVariableString( string str, byte[] rawData,
    int encodePos ) {             int curPos = encodePos;
                  int len = str.Length.ToString().Length;             curPos = EncodePositiveInt32(len, rawData, curPos, 1);</p>
  
  <pre><code>                  curPos = EncodePositiveInt32(str.Length, rawData, curPos, len);
  
          return Encoding.ASCII.GetBytes(str, 0, str.Length, rawData, curPos) + curPos;         }
  </code></pre>
  </blockquote>
  
  <p>Client is also entering the same username and password, but he is getting error and i am not getting error. It should throw error in both PDAs right.
  I have hard coded the values given by the client. It is working in my PDA,but it is not working in client PDA.
  One difference i have seen is , in my PDA Byte[] rawdata.length=105
  and in client PDA it is rawdata.length=96.</p>
  
  <p>I am unable to reproduce the error in my device.</p>
  
  <p>Any thoughts  on this issue?</p>
  
  <p>Thanks</p>