Copied to clipboard

Flag this post as spam?

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


  • Sam Stuewe 12 posts 82 karma points
    Jun 08, 2020 @ 16:26
    Sam Stuewe
    0

    NullReferenceException After installing on 7.6

    We just upgraded my client's umbraco instance to 7.6 so that it would be compatible with TranslationManager. After I install Translation Manager 2.4.8, when I run the site locally, if I click on any Umbraco section (e.g., Settings, Media, etc.) that changes the Tree, I get the following NullReferenceException:

    at Umbraco.Web.Trees.ApplicationTreeExtensions.<TryGetRootNodeFromControllerTree>d__1.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.<GetRootForMultipleAppTree>d__1.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__0.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 System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__3`1.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 System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.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 System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
    
    --- End of stack trace from previous location where exception was thrown ---
    
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.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 System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.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 System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
    
    --- End of stack trace from previous location where exception was thrown ---
    
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.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 System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.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 System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
    
    --- End of stack trace from previous location where exception was thrown ---
    
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.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 System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.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 System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
    
    --- End of stack trace from previous location where exception was thrown ---
    
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.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 System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.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 System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.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 System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.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 System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.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 System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()
    
    --- End of stack trace from previous location where exception was thrown ---
    
       at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.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 System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()
    

    If I remove the package and its dependencies, the error immediately goes away. Is there a configuration I need to setup for this to work properly?

  • Kevin Jump 2342 posts 14869 karma points MVP 8x c-trib
    Jun 08, 2020 @ 16:48
    Kevin Jump
    0

    Hi Sam,

    are you using any Dependency Injection style things (e.g autofac, unity ?) these need extra code to register trees for umbraco.

    Its also been a while since we have put the root code onto a new Umbraco 7.6 site so we might need to check that.

    Kevin .

  • Sam Stuewe 12 posts 82 karma points
    Jun 08, 2020 @ 17:04
    Sam Stuewe
    0

    Kevin,

    Thank you for the quick reply! we have some DI things setup. What extra code is needed?

  • Kevin Jump 2342 posts 14869 karma points MVP 8x c-trib
    Jun 08, 2020 @ 17:09
    Kevin Jump
    100

    Hi,

    Similar to this : https://our.umbraco.com/packages/developer-tools/diplo-trace-log-viewer/diplo-trace-log-viewer/70615-null-reference-exception#comment-297490

    for autofac i beleive it might look like this :

    builder.RegisterApiControllers(typeof(Jumoo.TranslationManager.Core).Assembly);
    builder.RegisterApiControllers(typeof(Jumoo.TranslationManager.Translator).Assembly);
    
  • Sam Stuewe 12 posts 82 karma points
    Jun 08, 2020 @ 17:22
    Sam Stuewe
    0

    Kevin,

    I bet you're probably right about this being the issue. We do indeed have autofac setup, but the code you pasted uses namespaces as if they are types. Do I need to have a line for each of the controllers in each of those namespaces, or are there specific controllers I should register?

    All the best,

    -Sam

  • Sam Stuewe 12 posts 82 karma points
    Jun 08, 2020 @ 17:42
    Sam Stuewe
    0

    Kevin,

    Following your recommendation a little further, the following two lines appear to have the back-office fully-operational again:

    builder.RegisterApiControllers(typeof(Jumoo.TranslationManager.Core.Controllers.TranslationCultureApiController).Assembly);
    builder.RegisterApiControllers(typeof(Jumoo.TranslationManager.Translator.Controllers.TranslatorApiController).Assembly);
    

    Thank you Kevin!

    All the best,

    -Sam

Please Sign in or register to post replies

Write your reply to:

Draft