Server Error in '/' Application.

Sequence contains no matching element

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 matching element

Source Error:


Line 302:        //int lineNumber=oEx.StackTrace.Substring()
Line 303:        var LineNumber = new StackTrace(oEx, true).GetFrame(0).GetFileLineNumber();
Line 304:        var methodname = new StackTrace(oEx, true).GetFrames().Select(f => f.GetMethod()).First(m => m.Module.Assembly == Assembly.GetExecutingAssembly()).Name;
Line 305:        string methodName = site == null ? null : site.Name;
Line 306:        ErrorHandler.LogErrorInXML(oEx.Message + " line No:" + LineNumber + ", Method Name:" + methodname, Request.Url.ToString(), methodName);

Source File: c:\Sites\live\EcommerceBlogDetail.aspx.cs    Line: 304

Stack Trace:


[InvalidOperationException: Sequence contains no matching element]
   System.Linq.Enumerable.First(IEnumerable`1 source, Func`2 predicate) +281
   EcommerceBlogDetail.Page_Error(Object sender, EventArgs e) in c:\Sites\live\EcommerceBlogDetail.aspx.cs:304
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +52
   System.Web.UI.TemplateControl.OnError(EventArgs e) +121
   System.Web.UI.Page.HandleError(Exception e) +86
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6787
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +250
   System.Web.UI.Page.ProcessRequest() +76
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +24
   System.Web.UI.Page.ProcessRequest(HttpContext context) +62
   ASP.ecommerceblogdetail_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\374608f3\28e99558\App_Web_r2j4slr0.28.cs:0
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +195
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +50
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +73


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