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 52:         Else
Line 53:             'caso senza parametri
Line 54:             immo = (From immobili In dbcontext.pkproperty
Line 55:                     Where immobili.idimmobile = getid
Line 56:                     Order By immobili.idimmobile Descending

Source File: D:\inetpub\webs\auroracaseit\scheda.aspx.vb    Line: 54

Stack Trace:


[InvalidOperationException: Sequence contains no elements]
   System.Linq.Enumerable.First(IEnumerable`1 source) +335
   System.Data.Objects.ELinq.<>c__11`1.<GetElementFunction>b__11_0(IEnumerable`1 sequence) +43
   System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle(IEnumerable`1 query, Expression queryRoot) +61
   System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression) +134
   System.Linq.Queryable.First(IQueryable`1 source) +220
   _Scheda.Page_Load(Object sender, EventArgs e) in D:\inetpub\webs\auroracaseit\scheda.aspx.vb:54
   System.Web.UI.Control.OnLoad(EventArgs e) +97
   System.Web.UI.Control.LoadRecursive() +61
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +693


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