Copied to clipboard

Flag this post as spam?

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


  • Biagio Paruolo 1583 posts 1814 karma points c-trib
    Mar 05, 2014 @ 11:52
    Biagio Paruolo
    0

    Very disappointed for error Object reference not set to an instance of an object.

    I've a big problem with UBlogsy package on U6.1.6 amd I lose a lot of time to understand why!

    Is't a UBlogsy or Umbraco bug?

    Every time that I open a post, a landing page, the server goes in error with:

    Object reference not set to an instance of an object.

    Line 47:     // show each post
    Line 48:     foreach (var n in posts)
    Line 49:     {
    Line 50:         @Html.Partial("uBlogsy/Landing/uBlogsyLandingShowPost", new ViewDataDictionary(ViewData) { { "Node", n }, { "GravatarSize", 40 }, { "ImageWidth", 300 }, { "ImageHeight", -1 } })


    Source File: c:\HostingSpaces\xyzv\dfgt\wwwroot\Views\Partials\uBlogsy\Landing\uBlogsyLandingListPosts.cshtml    Line: 48 

    Stack Trace: 

    [NullReferenceException: Object reference not set to an instance of an object.]
       Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedContentCache.<get_GetXmlDelegate>b__2(UmbracoContext context, Boolean preview) +84
       Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedContentCache.GetById(UmbracoContext umbracoContext, Boolean preview, Int32 nodeId) +36
       Umbraco.Web.PublishedCache.ContextualPublishedCache`1.GetById(Boolean preview, Int32 contentId) +40
     
  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Mar 05, 2014 @ 12:45
    Anthony Dang
    0

    This sounds like file permissions:

    http://our.umbraco.org/wiki/reference/files-and-folders/permissions

    Ensure that the hosting environment is Full Trust

    Verify that it works on your local machine, and that ALL files are deployed.

    Verify that /app_data/umbraco.config is updated when you publish from the backoffice.

     

  • Biagio Paruolo 1583 posts 1814 karma points c-trib
    Mar 05, 2014 @ 14:06
    Biagio Paruolo
    0

    Hi,

    all permissions are ok. I see that umbraco.config is updated when I publish. Full Trust is active. 

    I see if I remove umbraco.config and Examine indexes under TEMP, I see posts.

    I disable <uLoremsy> <tree nodeName="*" enabled="false">

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Mar 05, 2014 @ 15:43
    Anthony Dang
    0

    So it is working?

    If so, it could have been corrupt examine indexes.

     

     

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Mar 05, 2014 @ 15:56
    Anthony Dang
    0

    So it is working?

    If so, it could have been corrupt examine indexes.

     

     

  • Biagio Paruolo 1583 posts 1814 karma points c-trib
    Mar 05, 2014 @ 16:42
    Biagio Paruolo
    0

    I tried to play with content and I have not the error until now.

    So, for other people:

    - remove umbraco.config and all index files under TEMP\Examine\<folders>

    Why Indexes Will be corrupted?

     

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Mar 05, 2014 @ 18:11
    Anthony Dang
    0

    I have no idea why the indexes get corrupted. All I know is that from time to time that's a cause of major pain.

    Good to hear you solved your problem though.

     

  • Biagio Paruolo 1583 posts 1814 karma points c-trib
    Mar 05, 2014 @ 23:27
    Biagio Paruolo
    0

    I'm afraid, but the problem is still there!

    I think that there is some bug on Examine...

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Mar 07, 2014 @ 10:04
    Anthony Dang
    0

    Turn off your app, then delete the examine indexes.

    Check if that they are regenerated and everything is working.

    If things stop working after that then I think it's likely a permission issue. Is this local (laptop?) or a server? Is the server loadbalanced?

     

  • Biagio Paruolo 1583 posts 1814 karma points c-trib
    Mar 07, 2014 @ 13:46
    Biagio Paruolo
    0

    No, I tried that before and indexes are regenerated into their folder. It's on the server and not loadbalanced.

  • Shannon Deminick 1524 posts 5269 karma points MVP 2x
    Mar 10, 2014 @ 00:56
    Shannon Deminick
    0

    The error is coming from:

    Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedContentCache.

    This doesn't use Examine at all.

    Rebuilding the examine indexes after an app restart might also regen the xml cache. Unless there's something on this line:

    foreach (var n in posts)

    that is accessing the media cache - which does use Examine?

    There's nothing in this stack trace to indicate this is an Examine or index problem. However, it does look like a problem someplace with the XML cache and IPublishedContent.

    Can you provide steps to replicate this problem?

  • Biagio Paruolo 1583 posts 1814 karma points c-trib
    Apr 03, 2014 @ 12:03
    Biagio Paruolo
    0

    The problem continue. It's reported by other users,too.

  • Biagio Paruolo 1583 posts 1814 karma points c-trib
    Apr 10, 2014 @ 18:04
    Biagio Paruolo
    0

    The cache problem is still here. Is't possibile to disable uBlogsy to use Examine or it's a core problem????

    I report here the error: http://issues.umbraco.org/issue/U4-4334

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Apr 15, 2014 @ 16:35
    Anthony Dang
    0

    Hi 

    This is probably not the ideal solution, but you could wrap the code in a try-catch. This will at least stop the crash.

    try{

        var posts = PostService.Instance.GetPosts(Model.Content, tag, label, author, searchTerm, commenter, year, month, day, out postCount).Skip((page - 1) * itemsPerPage).Take(itemsPerPage).ToIPublishedContent(true);

            //var posts = NoLuceneFallbackService.Instance.GetPosts(Model.Content.Id, tag, label, author, searchTerm, commenter, year, month, out postCount).Skip((page - 1) * itemsPerPage).Take(itemsPerPage);

        // pagination

        @RenderPagination(page, postCount, itemsPerPage)

        @RenderForLanding(posts)

    }

    catch(Exception ex){}

     

  • Aleksei Kulitskov 3 posts 23 karma points
    Jul 11, 2014 @ 14:11
    Aleksei Kulitskov
    0

    Hi everyone,

    This is my first post. I just wanted to share my solution to this problem! Actually, this problem occurs when the application tries to convert array of Examine.SearchResult to IPublishedContent.

    There are 4 files that you have to change in order to uBlogsy to work fine:

    • uBlogsyLandingListPosts.cshtml
    • uBlogsyPostListRelatedPosts.cshtml
    • uBlogsyWidgetListPosts.cshtml
    • uBlogsyWidgetListPostsForHome.cshtml

    As an example I have chosen uBlogsyLandingListPosts.cshtml:

    Change this

    var posts = PostService.Instance.GetPosts(Model.Content, tag, label, author, searchTerm, commenter, year, month, day, out postCount).Skip((page - 1) * itemsPerPage).Take(itemsPerPage).ToIPublishedContent(true);
    

    To this:

    var posts = PostService.Instance.GetPosts(Model.Content, tag, label, author, searchTerm, commenter, year, month, day, out postCount).Skip((page - 1) * itemsPerPage).Take(itemsPerPage);
        //.ToIPublishedContent(true);
    

    Then change the data type of parameter's IEnumerable from IPublishedContent to Examine.SearchResult.

    @helper RenderForLanding(IEnumerable<IPublishedContent> posts)
    

    Change to this:

    @helper RenderForLanding(IEnumerable<Examine.SearchResult> posts)
    

    And finally, take each node's id and get this node's IPublishedContent:

    foreach (var item in posts)
    {
        IPublishedContent n = Umbraco.TypedContent(item.Id);
    @Html.Partial("uBlogsy/Landing/uBlogsyLandingShowPost", new ViewDataDictionary(ViewData) { { "Node", n }, { "GravatarSize", 40 }, { "ImageWidth", 300 }, { "ImageHeight", -1 } })
    }
    

    And that's it. Solved my problem and all is working now. Integrating it with my website at the moment.

    Good luck to all!

    Best regards, Alex

  • uncitizen 1 post 21 karma points
    Jun 12, 2015 @ 20:44
    uncitizen
    0

    Thanks, Aleksey!

    Your solution works great.

  • Biagio Paruolo 1583 posts 1814 karma points c-trib
    Aug 03, 2014 @ 17:04
    Biagio Paruolo
    0

    Hi,

    Have you tried if "publish at" work with this work around?

     

  • Aleksei Kulitskov 3 posts 23 karma points
    Aug 03, 2014 @ 20:02
    Aleksei Kulitskov
    0

    Hi Biagio,

    Do you mean the bug when you have an unpublished news item and the site reports an error? If yes, then you have to modify a few things more. I am not at work right now, so I do not have the code at hand, but, perhaps, tomorrow I will be able to post a comment about fixing it.

    Best regards,

    Alex

  • Aleksei Kulitskov 3 posts 23 karma points
    Aug 12, 2014 @ 09:46
    Aleksei Kulitskov
    0

    Hi Biagio,

    Sorry, I just didn't have the time to post a reply with code. So, this is what I did:

    var publishedPosts = PostService.Instance.GetPosts(Model.Content, tag, label, author, searchTerm, commenter, year, month, day, out postCount).Where(n => n.ToIPublishedContent() != null && n.ToIPublishedContent().Parent != null)
    

    It just checks if this node has content published (in case of not published news) and if the parent node is published (in case of the day is not published). Because it usually happens, when you publish the news node and folders, such as year, month and day don't get published.

    Hope this helps.

    Best regards,

    Alex

  • Danny Blatant 91 posts 358 karma points
    Oct 15, 2014 @ 11:46
    Danny Blatant
    0

    I'd just like to say thanks to the guys on this thread, it helped me solve my issue of "Object reference not set to an instance of an object." after deploying my site in VS2013.

    After deployment I had this error, the debug info indicated that the Html object on my homepage was null! For me it was a case of corrupt Examine Indexes. Deleted /App_Data/TEMP/ExamineIndexes/* and everything rebuilt fine!

    Many thanks,

    Danny "Blatant"

  • Biagio Paruolo 1583 posts 1814 karma points c-trib
    Oct 15, 2014 @ 11:52
    Biagio Paruolo
    0

    Hi,

    Danny try to upgrade to last version of UBlogsy. It solve some bugs ( like null error wrote in this post ) and compliance with 6.2.x. 

  • Danny Blatant 91 posts 358 karma points
    Oct 15, 2014 @ 11:57
    Danny Blatant
    0

    Thanks Biagio, But I am not using uBlogsy! :D

    I just wanted to say thanks anyway because my bug was caused by an ExamineIndexes corruption, which was discussed earlier in the thread. It seems my specific issue is more an Umbraco deployment thing, not just something that can effect your package.

    Kind Regards,

    Danny "Blatant"

  • Disham Parikh 5 posts 75 karma points
    Jan 19, 2016 @ 06:17
    Disham Parikh
    0

    Hi,

    I am facing same issue, i have upgraded version of umbraco (version 7.3.0), and uBlogsy(4.1.2).

    Strange thing is that, after restarting IIS App pool, its starts working fine. But this is not the solution.

    Any one have permanent solution of this issue??

  • Michael Sims 119 posts 387 karma points
    Mar 22, 2016 @ 06:52
    Michael Sims
    0

    Hi,

    Anyone figured a solution to this one yet?

Please Sign in or register to post replies

Write your reply to:

Draft