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 42:         StringBuilder CodeDiv = new StringBuilder();
Line 43: 
Line 44:         int colonneQnt = elencoTariffe.Max(x => x.Prezzi.Count());
Line 45: 
Line 46: 

Source File: d:\inetpub\webs\acasadichiarait\Templates\quattro\pagine\tariffe.ascx    Line: 44

Stack Trace:


[InvalidOperationException: Sequence contains no elements]
   System.Linq.Enumerable.Max(IEnumerable`1 source) +4969979
   System.Linq.Enumerable.Max(IEnumerable`1 source, Func`2 selector) +58
   ASP.camere.LoadTabellaPrezzi() in d:\inetpub\webs\acasadichiarait\Templates\quattro\pagine\tariffe.ascx:44
   ASP.camere.Page_Load(Object sender, EventArgs e) in d:\inetpub\webs\acasadichiarait\Templates\quattro\pagine\tariffe.ascx:12
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +52
   System.Web.UI.Control.OnLoad(EventArgs e) +97
   System.Web.UI.Control.LoadRecursive() +61
   System.Web.UI.Control.LoadRecursive() +134
   System.Web.UI.Control.LoadRecursive() +134
   System.Web.UI.Control.LoadRecursive() +134
   System.Web.UI.Control.LoadRecursive() +134
   System.Web.UI.Control.LoadRecursive() +134
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +693


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