We have moved to GitHub Issues
Created by Murray Roke 02 Mar 2015, 21:57:23 Updated by Sebastiaan Janssen 18 Jul 2016, 15:58:40
Our project includes Autofac,
we register a custom Application which inherits from
Everything was working until...
I installed a nuget package uMigrate, and the developer section now does not show any trees.
The exception included at the end of this description is shown in the RHS error pane slide out.
My Resolution: In order to resolve the issue I had to (by guesswork) add the following controller registration.
Desired Changes I'm not really sure about the best way to address this, but here's some ideas:
Exception when TreeController is not registered:
Received an error from the server Failed to retrieve data for application tree developer 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.<TryGetRootNodeFromControllerTree>d__4.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.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Umbraco.Web.Trees.ApplicationTreeController.<GetRootForMultipleAppTree>d__12.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.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Umbraco.Web.Trees.ApplicationTreeController.<GetApplicationTrees>d__4.MoveNext()
The best we can do is handle the null reference properly so you get a more detailed exception message. We cannot put anything in the core relating to auto-fac since we don't reference it.
That sounds good. Question, how does umbraco register these controllers if autofac is not present, perhaps we can have autofac do the same thing?
Umbraco doesn't 'register' anything, it doesn't use IoC because we don't want to get in the way of you using IoC. MVC and WebApi don't require IoC, it's up to the developer to choose if they want to use it or not. All containers work slightly differently. Auto-fac (and other containers) have helper methods to scan assemblies for controllers to register. Also since the controller you've mentioned is completely outside of Umbraco core, it will still be up to you to ensure the controllers in that project are registered. You could probably pester that package developer to update their documentation in regards to this.
Backwards Compatible: True
Affected versions: 7.2.2, 7.2.8
Due in version: