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 1377:        //int lineNumber=oEx.StackTrace.Substring()
Line 1378:        var LineNumber = new StackTrace(oEx, true).GetFrame(0).GetFileLineNumber();
Line 1379:        var methodname = new StackTrace(oEx, true).GetFrames().Select(f => f.GetMethod()).First(m => m.Module.Assembly == Assembly.GetExecutingAssembly()).Name;
Line 1380:        string methodName = site == null ? null : site.Name;
Line 1381:        ErrorHandler.LogErrorInXML(oEx.Message + " line No:" + LineNumber + ", Method Name:" + methodname, Request.Url.ToString(), methodName);

Source File: c:\Sites\live\ProductDetails.aspx.cs    Line: 1379

Stack Trace:


[InvalidOperationException: Sequence contains no matching element]
   System.Linq.Enumerable.First(IEnumerable`1 source, Func`2 predicate) +281
   ProductDetails.Page_Error(Object sender, EventArgs e) in c:\Sites\live\ProductDetails.aspx.cs:1379
   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.productdetails_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\374608f3\28e99558\App_Web_productdetails.aspx.cdcab7d2.hftpqnsu.0.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