YAFLogo

Reidy
  • Reidy
  • 51.2% (Neutral)
  • YAF Forumling Topic Starter
13 years ago
Hi

I'm very new to YAF and am running into the below error when trying to setup the forum on our site. Whenever I try to create a new topic I recieve the below error, however the topic is created anyway.

The funny thing is that the forum was installed and working on a local machine with local db without problem. I have simply attempted to reinstall - and repoint at the live db. Does anybody know how to resolve this?

Unfortunately I do not have the ability to run any patches on the live webserver's operating system, therefore I am looking for a fix which can be applied inside the YAF code itself.

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:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: Sequence contains no elements]

System.Linq.Enumerable.First(IEnumerable`1 source) +336

YAF.Pages.posts.BindData() +1609

YAF.Pages.posts.Page_Load(Object sender, EventArgs e) +4742

System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14

System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35

System.EventHandler.Invoke(Object sender, EventArgs e) +0

System.Web.UI.Control.OnLoad(EventArgs e) +91

System.Web.UI.Control.LoadRecursive() +74

System.Web.UI.Control.LoadRecursive() +146

System.Web.UI.Control.LoadRecursive() +146

System.Web.UI.Control.LoadRecursive() +146

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

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

Thanks

David

Sponsor
arifsharp
13 years ago
I am having similar issue, has you resolved your issue...?
Mek
  • Mek
  • 100% (Exalted)
  • YAF Developer
13 years ago
Same issue just cropped up today with no changes made by myself. Will see what I can find out.


UserPostedImage

"It's a case of RTFM.. the only problem being we don't have a manual!"

When I post FP:Mek in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting. (Yes I stole this off Ederon 🙂 )

timb
  • timb
  • 51.2% (Neutral)
  • YAF Forumling
13 years ago
http://forum.yetanotherforum.net/yaf_postst13019_Cannot-create-topic-if-time-on-sql-server-is-ahead-of-time-on-IIS-server.aspx [/i]

I narrowed this down to @ToPostedDate/@ToEditedDate for yaf_post_list being before the actual Posted/Edited date fields in yaf_Message after posting a new topic.

I noticed the times were about 20 seconds off.

We theorize the problem is the clock on the webserver is slightly off from the clock on the db server.

I put in a stop-gab solution of adding 5 minutes to both dates at the beginning of yaf_post_list. I searched the source code to see where post_list is called, and it looked like it was always passing in DateTime.UtcNow. Is there any danger of doing this for the time being?

(note: This is v1.9.5.5-RTW.)

Debug output from event log (with debug DLLs) in case it helps anyone:

System.InvalidOperationException: Sequence contains no elements
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at YAF.Pages.posts.BindData() in C:\Projects\Web\YAF-v1.9.5.5-RTW-SRC\YetAnotherForum.NET\pages\posts.ascx.cs:line 1046
   at YAF.Pages.posts.Page_Load(Object sender, EventArgs e) in C:\Projects\Web\YAF-v1.9.5.5-RTW-SRC\YetAnotherForum.NET\pages\posts.ascx.cs:line 693
   at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
bbobb
  • bbobb
  • 100% (Exalted)
  • YAF Developer
13 years ago
It was fixed in the current svn a while ago and will be in 1.9.5.6. Now the value for database scripts is taken from DateTime.UtcNow.

Frankly, many server admins don't think about database server time sync at all.

DMKI
  • DMKI
  • 51.2% (Neutral)
  • YAF Forumling
13 years ago
Well, I have this problem even when both web server and sql server are in the same windows domain, that is - they both get time from domain controller and don't have a difference bigger than 1 second from each other.
cvoong
  • cvoong
  • 56% (Neutral)
  • YAF Camper
13 years ago
Thanks for the fix - for anyone else interested here's the changeset:

http://yafnet.codeplex.com/SourceControl/changeset/changes/438f1ba11dd7