Server Error in '/' Application.

Sequence contains no elements

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Sequence contains no elements

Source Error:


Line 33: 		{
Line 34: 			command.Parameters.AddWithValue("@userId", user.ID);
Line 35: 			command.Parameters.AddWithValue("@selectedMenuId", new Guid(pathItems.Last().ID));
Line 36: 			command.Parameters.AddWithValue("@rootMenuId", new Guid(pathItems[0].ID));
Line 37: 			command.Parameters.AddWithValue("@seperator", seperator);

Source File: d:\web\arden-hallerne.dk\wwwroot\UserControls\Frontend\SubMenuV2.ascx.cs    Line: 35

Stack Trace:


[InvalidOperationException: Sequence contains no elements]
   System.Linq.Enumerable.Last(IEnumerable`1 source) +4928884
   UserControls_Frontend_SubMenuV2.FillItems(Page[] pathItems, IEnumerable`1 ExtraSubMenuItems) in d:\web\arden-hallerne.dk\wwwroot\UserControls\Frontend\SubMenuV2.ascx.cs:35
   _Default.Page_Load(Object sender, EventArgs e) in d:\web\arden-hallerne.dk\wwwroot\Default.aspx.cs:475
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +85
   System.Web.UI.Control.OnLoad(EventArgs e) +79
   System.Web.UI.Control.LoadRecursive() +130
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2849


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.9214.0