Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ismail Mayat 4511 posts 10059 karma points MVP 2x admin c-trib
    Dec 06, 2019 @ 16:32
    Ismail Mayat
    0

    Cannot access a disposed object error

    I have a document writing event its using IUmbracoContextFactory to get UmbracoContext.Content.GetByid all working fine. I now added another method that again uses the IUmbracoContextFactory however now on index rebuild i get the following error:

    enter image description here

    Anyone any ideas? FYI this is on umbraco 8.1.5

  • Ismail Mayat 4511 posts 10059 karma points MVP 2x admin c-trib
    Dec 09, 2019 @ 09:00
    Ismail Mayat
    101

    Ok so think I have this fixed I was doing:

     using (var umbracoContext = _umbracoContextFactory.EnsureUmbracoContext().UmbracoContext)
            {
                content = umbracoContext .Content.GetById(docArgs.ValueSet.Id.ToInt32());
            }
    

    What i needed todo was:

    using (var umbracoContext = _umbracoContextFactory.EnsureUmbracoContext())
            {
                content = umbracoContext.UmbracoContext.Content.GetById(docArgs.ValueSet.Id.ToInt32());
            }
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies