0

I've got an event receiver that fails, seemingly inconsistently. I've checked the ULS logs and I can see the 90hv Detected use of SPRequest for previously closed SPWeb object. Please close SPWeb objects when you are done with all objects obtained from them, but not before exception raised.

I've got two questions related to this:

Is this an exception that could explain the inconsistent way in which the event receiver works and sometimes doesn't work? I've debugged the code and functionally it's exactly as I'd expect. i.e. Does SharePoint manage the disposal of the object in question sometimes but sometimes it won't depending on system resource etc.?

Is this an exception that could break the code? Or is it just a warning?

EDIT:

It's worth pointing out that my code doesn't explicitly dispose of an object it attempts to reference - but it does without doubt have discrepancies with the way in which I don't dispose of objects I should be disposing of (no doubt memory leak issues) and I'm just looking for confirmation that given this scenario - the behaviour I'm seeing is as you'd expect. Either way, my code is under development now to correct it - just need help with diagnosis.

1 Answer 1

1

if you use SPList object outside of SPWeb object. then it generate error which you face.

for eg.

SPList splist = GetListBySite(siteurl,listname);
private void GetListBySite(string siteurl, string listname)
{
   using(SPSite spsite=new SPSite(siteurl))
   {
     using(SPWeb spweb=spsite.OpenWeb())
     {
        return spweb.Lists[listname];
     }
   }
}
1
  • The problem is that I can't appear to find any code that would imply this sort of error, and it's not consistent. So what I'm proposing is that I've just not disposed of something properly and as a result the SharePoint memory management system (however it works) is 'manually' disposing of it at a time when I need it - occasionally. +1, thanks a lot for your answer. Jan 14, 2013 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.