0
votes

I get an error in live application sometimes.

Stack trace:

at Tool.User_RequestSender.Page_Load(Object sender, EventArgs e) in d:\Site\Tool\User\RequestSender.aspx.cs:line 72 at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I tried again and again to run code om my machine but could not get same error.

Even i live code i get this issue once in while.

Page_Load Code in RequestSender.aspx.cs:

protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                this.LoadRequest();
            }
        }
        catch (CustomException ex)
        {
            this.ShowMessage(ex.Message);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

LoadRequest() is as follows:

private void LoadRequest()
    {
        Credential credential;


            if (
                !string.IsNullOrEmpty(Request["typeOfrequest"]) &&
                !string.IsNullOrEmpty(Request["empUserId"]) &&
                !string.IsNullOrEmpty(Request["applicationId"])
               )
            {
                // Get details of credentials
                credential = (new RequestManager()).GetCredential(this.EmpUserId, this.ApplicationId, (int)this.TypeOfrequest);
                this.applicaionRequest = new Request
                {
                    RequestType = this.TypeOfrequest,
                    RequestStatus = Enumerations.RequestStatus.Sent,
                    Application = credential.Application,

                    EmpUserId = credential.EmpUserId,
                    EmployeeId = credential.EmployeeId,
                    Username = credential.Username,

                    SenderAddress = Security.CurrentUser.Details.EmailAddress,
                    ReceiverAddress = (new Datastore.RequestStore()).GetReceiverAddress((int)this.TypeOfrequest, this.ApplicationId),
                    AddedBy = Security.CurrentUser.Details.UserId
                };
                    ucSendRequest.ApplicationRequest = applicaionRequest;

            }
            else
            {
                Response.Write("Invalid request!");
                Response.End();
            }
        }

    }
1
The fact that you've got a catch(Exception ex) { throw ex; } is masking the original cause. Get rid of that catch block and you'll get a better idea of what's going on.Jon Skeet
what is ucSendRequest?mihirj
Exaclty...but I am not able to get error on my machine...Even if i remove try catch i am not getting any error or issue again on my machine...user1181942
@mihirj: It is user controluser1181942
Catching an exception then issuing "throw ex" replaces the stacktrace which means you have less chance of finding out where your exception actually came from. If you need to rethrow an exception you've caught use "throw" on its own inside the catch block. If there is nothing in your catch block but the throw then you didn't need the catch block in the first place.Colin Mackay

1 Answers

0
votes

Error clearly states that smth is null during application execution.

To get any help you should either check for null values (Request in LoadRequest() can be a good candidate), or, better solution, to modify your catch blog to log which parameter caused application to crash.