Server Error in '/' Application.

Object reference not set to an instance of an object.

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.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 55:             List<Video> lstvideo = new VideoService().GetAll();
Line 56: 
Line 57:             RepRelatedVideos.DataSource = lstvideo.Where(m => m.ID != video.ID && m.VideoCategoryID == video.VideoCategoryID).Take(10).OrderByDescending(m => Guid.NewGuid()).ToList();
Line 58:             RepRelatedVideos.DataBind();
Line 59: 

Source File: d:\hostingspaces\cinemayekta.com\httpdocs\VideoDetail.aspx.cs    Line: 57

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   <>c__DisplayClass6.<ShowVideo>b__0(Video m) in d:\hostingspaces\cinemayekta.com\httpdocs\VideoDetail.aspx.cs:57
   System.Linq.WhereListIterator`1.MoveNext() +81
   System.Linq.<TakeIterator>d__25`1.MoveNext() +394
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +157
   System.Linq.<GetEnumerator>d__1.MoveNext() +207
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +452
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +72
   VideoDetail.ShowVideo() in d:\hostingspaces\cinemayekta.com\httpdocs\VideoDetail.aspx.cs:57
   VideoDetail.Page_Load(Object sender, EventArgs e) in d:\hostingspaces\cinemayekta.com\httpdocs\VideoDetail.aspx.cs:21
   System.Web.UI.Control.OnLoad(EventArgs e) +107
   System.Web.UI.Control.LoadRecursive() +89
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1532


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