U4-2379 - InvalidOperationException: Sequence contains no elements in ApplicationTreeRegistrar

Created by Josiah Thoen 15 Jun 2013, 19:19:18 Updated by Sebastiaan Janssen 20 Jun 2013, 19:26:18

Relates to: U4-2403

Getting the following error when installing courier and other packages. I think the issue stems from a plugin that inherits baseTree however does not add the TreeAttribrute to the class declaration. In my case I had installed the Examine Dashboard, http://our.umbraco.org/projects/developer-tools/examine-dashboard. This package prevent other packages like Courier from installing completely.

[InvalidOperationException: Sequence contains no elements] System.Linq.Enumerable.Single(IEnumerable1 source) +379 umbraco.BusinessLogic.ApplicationTreeRegistrar.<.ctor>b__0(Type x) +43 System.Linq.WhereSelectListIterator2.MoveNext() +245 System.Linq.WhereSelectEnumerableIterator2.MoveNext() +165 System.Linq.<ConcatIterator>d__711.MoveNext() +643 System.String.Join(String separator, IEnumerable`1 values) +273 umbraco.BusinessLogic.ApplicationTreeRegistrar..ctor() +848 umbraco.cms.businesslogic.packager.Installer.InstallBusinessLogic(Int32 packageId, String tempDir) +3160 umbraco.presentation.developer.packages.Installer.ProcessInstall(String currentStep) +716 umbraco.presentation.developer.packages.Installer.Page_Load(Object sender, EventArgs e) +618 umbraco.BasePages.BasePage.OnLoad(EventArgs e) +19 System.Web.UI.Control.LoadRecursive() +71 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178

1 Attachments

Download ApplicationTreeRegistrar.cs

Comments

Josiah Thoen 15 Jun 2013, 19:22:32

I was able to resolve the issue by changing umbraco.BusinessLogic.ApplicationTreeRegistrar default constructor line 25 from

var items = types.Select(x => new Tuple<Type, TreeAttribute>(x, x.GetCustomAttributes(false).Single())).Where(x => ApplicationTree.getByAlias(x.Item2.Alias) == null);

to

var items = types.Select(x => new Tuple<Type, TreeAttribute>(x, x.GetCustomAttributes(false).SingleOrDefault())).Where(x => x.Item2 != null && ApplicationTree.getByAlias(x.Item2.Alias) == null);


Josiah Thoen 15 Jun 2013, 19:45:13

Pull Request submitted: jdtbltilg:patch-1 https://github.com/jdtbltilg/Umbraco-CMS/commit/34d2695fc0c4f51774fefbea3bdf4ca27f228b74


Sebastiaan Janssen 18 Jun 2013, 10:55:02

Assigned to Shannon so he can have a look if this fix is correct or if there was a good reason not to use SingleOrDefault and null checking in the first place.


Shannon Deminick 20 Jun 2013, 01:29:45

This is the cause of this issue: U4-2403

@Sebastian, need to decide if we release a patch release for 4.x as the type finder issue above affects that too.


Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 6.1.1, 4.11.9, 6.0.5

Due in version: 6.0.7, 4.11.10

Sprint:

Story Points:

Cycle: