HexToString function returning maximum of 16kb The HexToString function returning maximum of 16kb even for sources greater than 16KB

string HexStringToString(string HexString)
        {
            string stringValue = "";
            for (int i = 2; i &lt; HexString.Length / 2; i++) // Starting from position too just to avoid the 0x Hex Code that messes stuff up
            {
                try
                {
                    string hexChar = HexString.Substring(i * 2, 2);
                    int hexValue = Convert.ToInt32(hexChar, 16);
                    stringValue += Char.ConvertFromUtf32(hexValue);
                }
                catch (Exception ExCon)
                {
                    //continue; //Forcing application to ignore anomaly in the file being processed
                    MessageBox.Show(ExCon.ToString());
                }
            }
            return stringValue;
        }
Just a few comments.

First, I'd change the loop a bit. Instead of:

for (int i = 2; i &lt; HexString.Length / 2; i++)
// ...
     HexString.Substring(i * 2, 2);


I'd use something like:

for (int i=2; i&lt;HexString.Length-1; i += 2)
// ...
    HexString.Substring(i, 2);


Note the Length - 1 though--if we happen to be passed a string with odd length, we don't want to index beyond its end.

Secondly, at least for general use, you almost certainly do not want this to catch the exception and display a MessageBox. The basic reason for using exception handling to start with is that a low-level function like this doesn't know (and shouldn't care) how such an exception will be handled/displayed, whether to continue execution after it happens, etc.