NULLReferenceException when using LINQ query with In clause
hi,
i not sure code breaking. kindly it's production issue. it's not happening in sit, on production. nullreferenceexception occurring when below method called:
internal bool isfilingpartywithactivelab(string docid)
{
ibackendmediator bckendmd = null;
list<doccasepartyentity> lstdcpwithlab = null;
try
{
if (!string.isnullorempty(docid))
{
bckendmd = new backendmediatorimpl();
list<doccasepartyentity> lstdcp = bckendmd.getlistdoccasepartybydocid(docid);
lstdcpwithlab = new list<doccasepartyentity>();
if (lstdcp != null && lstdcp.count > 0)
{
lstdcpwithlab = (from dcp in lstdcp
dcp.filingind == filingpartyind.y &&
dcp.haslac == yesno.y
select dcp).tolist();
}
if (lstdcpwithlab != null && lstdcpwithlab.count > 0)
{
foreach (doccasepartyentity dcp in lstdcpwithlab)
{
doccasepartylacdetailentity dcplacdetailentity = bckendmd.getdoccasepartylacdetailbydcpid(dcp.dcpid);
if (dcplacdetailentity != null)
{
if (dcplacdetailentity.lacrefstatus == lacrefstatus.a)
{
return true;
}
}
}
}
}
}
catch (exception ex)
{
log.error("exception during isfilingpartywithactivelab()", ex);
throw;
}
return false;
}
logged error is:
error 2015-04-16 10:23:05,296 20 iels.backend.tasklist.business.tasklistlabservice - exception during isfilingpartywithactivelab()
system.nullreferenceexception: object reference not set instance of object.
@ iels.backend.tasklist.business.tasklistlabservice.isfilingpartywithactivelab(string docid)
debug 2015-04-16 10:23:05,296 56 crimsonlogic.common.dms.utilities.sharepointhelper - :end getspfolder(http://url, ielsformxmltemplates)
error 2015-04-16 10:23:05,296 20 iels.backend.tasklist.presentation.taskitemapprovalpage - taskitemapproval: method-taskitemapproval.bindwaiverfeedetails, msg-system.nullreferenceexception: object reference not set instance of object.
@ iels.backend.tasklist.business.tasklistlabservice.isfilingpartywithactivelab(string docid)
@ iels.backend.tasklist.presentation.taskitemapprovalpage.bindwaiverfeedetails(list`1 feelistdto)
error 2015-04-16 10:23:05,296 20 iels.backend.tasklist.presentation.taskitemapprovalpage - tasklistapprovalpageexception occured @ page_load
system.nullreferenceexception: object reference not set instance of object.
@ iels.backend.tasklist.business.tasklistlabservice.isfilingpartywithactivelab(string docid)
@ iels.backend.tasklist.presentation.taskitemapprovalpage.bindwaiverfeedetails(list`1 feelistdto)
@ iels.backend.tasklist.presentation.taskitemapprovalpage.page_load(object sender, eventargs e)
error 2015-04-16 10:23:05,296 20 crimsonlogic.legal.bootstrapper.backend.exceptionhandlermodule - unhandled error occurred -
system.nullreferenceexception: object reference not set instance of object.
@ iels.backend.tasklist.business.tasklistlabservice.isfilingpartywithactivelab(string docid)
@ iels.backend.tasklist.presentation.taskitemapprovalpage.bindwaiverfeedetails(list`1 feelistdto)
@ iels.backend.tasklist.presentation.taskitemapprovalpage.page_load(object sender, eventargs e)
@ system.web.util.callihelper.eventargfunctioncaller(intptr fp, object o, object t, eventargs e)
@ system.web.util.callieventhandlerdelegateproxy.callback(object sender, eventargs e)
@ system.web.ui.control.onload(eventargs e)
@ system.web.ui.control.loadrecursive()
@ system.web.ui.control.loadrecursive()
@ system.web.ui.control.loadrecursive()
@ system.web.ui.control.loadrecursive()
@ system.web.ui.control.loadrecursive()
@ system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint)
error 2015-04-16 10:23:05,296 20 crimsonlogic.legal.bootstrapper.backend.bootstrapper - unknown application error occurred.
thanks, ss
hi all,thanks support.
issue has been resolved. problem not first if, last if. sit code didn't have null condition check , the code have pasted in question local environment. when restored dll sit local, reproduce issue in local. realized null check not in sit. therefore production throwing error.
once again lot.
~ss
Visual Studio Languages , .NET Framework > Visual C#
Comments
Post a Comment