Paul Rajs

Paul Rajs

  • NA
  • 641
  • 145.9k

the function evaluation was disabled because of an out of memory excep

Jul 3 2021 12:29 PM

Hi Developers,

In my project i got this error .

There is 180729 coming from db. when i am try to bind in gridview using websevice i got the "The function evaluation was disabled because of an out of memory exception" error 

my webservice code : .asmx.cs

public string GetClassWiseInventoryBasicDetails(string RequestData)
{
    string lstrReturn = string.Empty;
    string consumerKey = string.Empty;
    Models.CP.Inventory.Tag.GetBasicDetailsRequest objRequest = new Models.CP.Inventory.Tag.GetBasicDetailsRequest();
    try
    {
        RequestData = clsCommonCryptography.StringDecrypt(RequestData);
        clsErrorLog.WriteAppLogFiles(string.Format("Request :- {0}", RequestData), DateTime.Now, System.Reflection.MethodBase.GetCurrentMethod().Name, (this.GetType().Name + "/" + System.Reflection.MethodBase.GetCurrentMethod().Name), GetDeviceInfo());
        string message = "Oops server down!";
        using (TextReader sr = new StringReader(RequestData))
        {
            var serializer = new System.Xml.Serialization.XmlSerializer(typeof(Models.CP.Inventory.Tag.GetBasicDetailsRequest));
            objRequest = (Models.CP.Inventory.Tag.GetBasicDetailsRequest)serializer.Deserialize(sr);
        }
        var validationResult = DataAnnotation.ValidateEntity<Models.CP.Inventory.Tag.GetBasicDetailsRequest>(objRequest);
        if (Providers.DataMemberValidation.Validation.VerifyEntity(validationResult, ref message))
            lstrReturn = mobjIMPS.GetClassWiseInventoryBasicDetails(objRequest);
        else
            lstrReturn = "<?xml version='1.0' encoding='utf-8' standalone='no'?><Response><STATUSCODE>1</STATUSCODE><STATUS>" + message + "</STATUS></Response>";
            //clsErrorLog.WriteAppLogFiles(string.Format("Request:- {0}, Response :- {1}", RequestData, lstrReturn), DateTime.Now, this.GetType().Name, System.Reflection.MethodBase.GetCurrentMethod().Name, "", 1);
        lstrReturn = clsCommonCryptography.StringEncrypt(lstrReturn);
        return lstrReturn;
    }
    catch (Exception ex)
    {
        clsErrorLog.WriteErrLogFiles(string.Format("Request:- {0}, Response :- {1}, Error :- {2}", RequestData, lstrReturn, ex.Message), this.GetType().Name, System.Reflection.MethodBase.GetCurrentMethod().Name, "", 1, ex);
        clsErrorLog.WriteAppLogFiles(string.Format("Request:- {0}, Response :- {1}, Error :- {2}", RequestData, lstrReturn, ex.Message), DateTime.Now, this.GetType().Name, System.Reflection.MethodBase.GetCurrentMethod().Name, "", 1);
        lstrReturn = "<?xml version='1.0' encoding='utf-8' standalone='no'?><Response><STATUSCODE>1</STATUSCODE><STATUS>PLEASE TRY AGAIN</STATUS></Response>";
        lstrReturn = clsCommonCryptography.StringEncrypt(lstrReturn);
        return lstrReturn;
    }
    finally
    {
        if (objRequest != null)
            objRequest = null;
    }
}

webservice code : cls.cs

public string GetClassWiseInventoryBasicDetails(Models.CP.Inventory.Tag.GetBasicDetailsRequest objRequest)
{
    string lstrReturn = "";
    string lstrParam = "";
    StringBuilder lstrXmlString = new StringBuilder();
    try
    {
        string[] lstrInputArray = new string[] { "AGENTID|INT|" + objRequest.AgentId, "VEICLEID|VARCHAR|" + objRequest.VehicleId, "FLAG|INT|" + objRequest.Flag };
        string[] lstrOutputArray = new string[] { "cv_1" };
        lstrParam = string.Join(",", lstrInputArray);
        DataSet ldstDataset = mobjBusiness.Mth_withParamBankAdmin("ADM_GET_CLASSWISEINVENTORYDETAILS", lstrInputArray, lstrOutputArray);
        if (ldstDataset != null)
        {
            if (ldstDataset.Tables.Count > 0)
            {
                if (ldstDataset.Tables[0].Rows.Count > 0)
                {
                    lstrXmlString.Append("<?xml version='1.0' encoding='utf-8' standalone='no'?><Response><STATUSCODE>0</STATUSCODE><STATUS>SUCCESS</STATUS>");
                    if (ldstDataset.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i <= ldstDataset.Tables[0].Rows.Count - 1; i++)
                        {
                            lstrXmlString.Append("<GetBasicDetails>");
                            foreach (DataColumn column in ldstDataset.Tables[0].Columns)
                                lstrXmlString.AppendFormat("<{0}>{1}</{0}>", column.ColumnName, ldstDataset.Tables[0].Rows[i][column.ColumnName]);
                            lstrXmlString.Append("</GetBasicDetails>");
                        }
                    }
                    lstrXmlString.Append("</Response>");
                    lstrReturn = lstrXmlString.ToString();
                }
                else
                    lstrReturn = "<?xml version='1.0' encoding='utf-8' standalone='no'?><Response><STATUSCODE>1</STATUSCODE><STATUS>Data Not Available</STATUS></Response>";
            }
            else
                lstrReturn = "<?xml version='1.0' encoding='utf-8' standalone='no'?><Response><STATUSCODE>1</STATUSCODE><STATUS>Please try again</STATUS></Response>";
        }
        else
           lstrReturn = "<?xml version='1.0' encoding='utf-8' standalone='no'?><Response><STATUSCODE>1</STATUSCODE><STATUS>Please try again</STATUS></Response>";
    }
    catch (Exception ex)
    {
        clsErrorLog.WriteErrLogFiles(string.Format("Request:- {0}, Response :- {1}, Error :- {2}", lstrParam, lstrReturn, ex.Message), this.GetType().Name, System.Reflection.MethodBase.GetCurrentMethod().Name, "", 1, ex);
        clsErrorLog.WriteAppLogFiles(string.Format("Request:- {0}, Response :- {1}, Error :- {2}", lstrParam, lstrReturn, ex.Message), DateTime.Now, this.GetType().Name, System.Reflection.MethodBase.GetCurrentMethod().Name, "", 1);
        lstrReturn = "<?xml version='1.0' encoding='utf-8' standalone='no'?><Response><STATUSCODE>1</STATUSCODE><STATUS>PLEASE TRY AGAIN</STATUS></Response>";
    }
    finally
    {
        lstrXmlString = null;
    }
    string test = "";
    return lstrReturn;
}

If there is any possible to fix this error , kindly suggest me.

Thanks and Regards,

Paul.S


Answers (1)