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 32:             return;
Line 33: 
Line 34:         var breadcrumbs = Samples.AspNet.BreadcrumbsHelper.Breadcrumbs;
Line 35:         section_id = (int)(breadcrumbs["section_id"] ?? -1);
Line 36:         category_id = (int)(breadcrumbs["category_id"] ?? -1);

Source File: D:\Inetpub\vhosts\snzparts.ru\snzparts\_HeaderDiv.ascx    Line: 34

Stack Trace:


[InvalidOperationException: Sequence contains no elements]
   System.Linq.Enumerable.Last(IEnumerable`1 source) +4941356
   Samples.AspNet.BreadcrumbsInfo.OnUpdated(String key, Object value) in W:\inetpub\wwwroot\shina\SourceCodes\BreadcrumbsHelper.cs:106
   Samples.AspNet.BreadcrumbsHelper.get_Breadcrumbs() in W:\inetpub\wwwroot\shina\SourceCodes\BreadcrumbsHelper.cs:176
   ASP.HeaderDiv.Page_Init(Object sender, EventArgs e) in D:\Inetpub\vhosts\snzparts.ru\snzparts\_HeaderDiv.ascx:34
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +52
   System.Web.UI.Control.OnInit(EventArgs e) +97
   System.Web.UI.UserControl.OnInit(EventArgs e) +87
   System.Web.UI.Control.InitRecursive(Control namingContainer) +142
   System.Web.UI.Control.InitRecursive(Control namingContainer) +318
   System.Web.UI.Control.InitRecursive(Control namingContainer) +318
   System.Web.UI.Control.InitRecursive(Control namingContainer) +318
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +416


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