Copied to clipboard

Flag this post as spam?

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


  • Joseph 59 posts 140 karma points
    Feb 18, 2015 @ 00:34
    Joseph
    0

    Web API fail causes TryLoadFromControllerTree to fail

    Hello

    I just installed the Tag Manager package on an Umbraco 7.2.1 project and am getting the following error when I hit the Tag Manager tab:

    Received an error from the server Failed to retrieve data for application tree TagManager

    Object reference not set to an instance of an object.
    EXCEPTION DETAILS:
    
    System.NullReferenceException: Object reference not set to an instance of an object.
    STACKTRACE:
    
    at Umbraco.Web.Trees.ApplicationTreeExtensions.TryLoadFromControllerTree(ApplicationTree appTree, String id, FormDataCollection formCollection, HttpControllerContext controllerContext)
       at Umbraco.Web.Trees.ApplicationTreeController.<GetRootForSingleAppTree>d__17.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Umbraco.Web.Trees.ApplicationTreeController.<GetApplicationTrees>d__4.MoveNext()
    

    I googled around and found forum posts from about a year ago which could likely be the source of this issue: here and here - this project does use Autofac (although a relatively old version - 3.1) and so this could possibly be a similar issue. It turns out that the Web Api dependency resolver was not set up correctly; when I fixed that issue, I was able to write a test UmbracoApiController and confirmed that that was working.

    However the Tag Manager package continues to throw up the same exception as above!

    Any ideas what could be causing this?

  • Nigel Wilson 931 posts 2043 karma points
    Feb 18, 2015 @ 17:47
    Nigel Wilson
    0

    Hi Joseph

    Sorry for asking but you have tags within your site ? 

    Other than that I simply have no idea what the issue might be - I know I haven't tested the tag manager package on a site with no tags, so hence the suggestion.

    Cheers

    Nigel

  • Joseph 59 posts 140 karma points
    Feb 18, 2015 @ 20:37
    Joseph
    0

    Hello Nigel

    I've just checked - the site does have tags in it.

    I'll try posting this question on the general forum to see if I can get any general guidance around Umbraco's use of Web API.

    cheers Joseph

  • Nigel Wilson 931 posts 2043 karma points
    Feb 19, 2015 @ 19:42
    Nigel Wilson
    0

    Hi Joseph

    Another thought... Is the site a clean install, or has it been upgraded. Just wondering if there are any legacy DLL's that may be causing issues ?

    Cheers

    Nigel

  • Joseph 59 posts 140 karma points
    Feb 19, 2015 @ 20:40
    Joseph
    0

    Hi Nigel

    This site has been upgraded from 6.1 so it could be related. Any specific DLLs I should check for?

    cheers Joseph

  • Joseph 59 posts 140 karma points
    Mar 04, 2015 @ 03:46
    Joseph
    102

    I've figured this problem out; as it turns out for projects that are built using Autofac, you need to manually register web API controllers for specific packages that are added. I got TagManager to work by adding this to my Autofac registration code:

    builder.RegisterApiControllers(typeof (Yoyocms.Umbraco7.TagManager.TagManagerTreeController).Assembly);
    
  • Ismail Mayat 4489 posts 10011 karma points MVP 2x admin c-trib
    1 week ago
    Ismail Mayat
    0

    belated thanks but you just solved my issue, i am using autofac with this package and was getting same error.

Please Sign in or register to post replies

Write your reply to:

Draft