Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jesper Ordrup 1019 posts 1528 karma points MVP
    Mar 05, 2013 @ 12:12
    Jesper Ordrup
    0

    String was not recognized as a valid DateTime.

    Just installed nforum 1.6 in a vanilla Umbraco 4.11.5.

    I've published the default forum and added a category. When accessing the forum (website) I get:

     

    String was not recognized as a valid DateTime.

     

    [FormatException: String was not recognized as a valid DateTime.]
       System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +10436490
       System.Convert.ToDateTime(String value) +83
       nForum.BusinessLogic.Models.NodeMapper.MapForumCategory(SearchResult nodetomap) +258
       nForum.BusinessLogic.Data.ForumFactory.<ReturnAllCategories>b__8(SearchResult searchResult) +47
       System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +145
       System.Linq.Buffer`1..ctor(IEnumerable`1 source) +216
       System.Linq.<GetEnumerator>d__0.MoveNext() +110
       System.Linq.WhereEnumerableIterator`1.MoveNext() +85
       System.Linq.Enumerable.Any(IEnumerable`1 source) +77
       nForum.usercontrols.nForum.ForumMainList.CreateMainForumList() +238
       nForum.usercontrols.nForum.ForumMainList.Page_Load(Object sender, EventArgs e) +72
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
       System.Web.UI.Control.OnLoad(EventArgs e) +92
       System.Web.UI.Control.LoadRecursive() +54
       System.Web.UI.Control.LoadRecursive() +145
       System.Web.UI.Control.LoadRecursive() +145
       System.Web.UI.Control.LoadRecursive() +145
       System.Web.UI.Control.LoadRecursive() +145
       System.Web.UI.Control.LoadRecursive() +145
       System.Web.UI.Control.LoadRecursive() +145
       System.Web.UI.Control.LoadRecursive() +145
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

     

    Any clues?

    best
    Jesper

  • Jesper Ordrup 1019 posts 1528 karma points MVP
    Mar 06, 2013 @ 01:47
    Jesper Ordrup
    0

    Hi again,

    Debugging shows that Convert.ToDateTime(CheckFieldExists(nodetomap, "__Sort_createDate"))  is the problem as SearchResult nodetomap doesnt contain __Sort_createDate at all.

    As nodetomap contained createDate I tried using that - but this is not a valid date. I could do some fixing there but maybe it's just a matter of a missing __Sort_createDate in the examine index (which i not absolutly nothing about).

    best
    Jesper 

  • Alex 6 posts 26 karma points
    Mar 08, 2013 @ 21:09
    Alex
    0

    I have the same issue after creating and publishing category. Have you solved it?

  • Jesper Ordrup 1019 posts 1528 karma points MVP
    Mar 08, 2013 @ 21:47
    Jesper Ordrup
    0

    No. I'm not familiar with examine and I think that the problem is something to do with ___sort_createdate 

  • Alex 6 posts 26 karma points
    Mar 08, 2013 @ 23:06
    Alex
    0

    I've just installed nForum not on Umbraco 4.11.5. but on 4.8.1 (as it's said in description) and it works fine.

  • Hasheem Maloo 7 posts 29 karma points
    Apr 03, 2013 @ 13:25
    Hasheem Maloo
    0

    I have the same problem - works on my local, but not on staging. Umbraco 4.11/ 6.03 and nForum 1.6

  • Sören Deger 733 posts 2844 karma points c-trib
    Apr 16, 2013 @ 12:04
    Sören Deger
    0

    I have the same probleme, too. Umbraco 6.0.3 and nForum 1.6.. I have rebuild examine indexes, but problem persists.

    Has anyone a solution to fix this?

     

    Sören

  • Hasheem Maloo 7 posts 29 karma points
    Apr 16, 2013 @ 12:12
    Hasheem Maloo
    1

    Hi Soren,

    I ended up having to hack it.. heres my code:

    __Sort_creatDate doesnt seem to be used anymore in umbraco 6.03 so createDate is what is stored in the index and is stored: like this: 20130416000000000 instead of 20130-04-16 00:00:00 

    so in NodeMapper.cs: you need to modify all mappings that use the SearchResult object :

    CreatedOn = CheckDateIsValid(nodetomap, "createDate"),

    below is my date checker/ changer.

     /// <summary>

            /// There is a bug in umbraco examine,  8/31/2010 is stored as 20130416000000000 instead of 20130-04-16 00:00:00Z. This is causing an error every time one of these nodes shows up in the search results.

            /// lucene is a frickin pain in the arse

            /// </summary>

            /// <returns></returns>

            private DateTime CheckDateIsValid(SearchResult result, string keyName)

            {

                string dateString;

                DateTime dt;

                dateString =  result.Fields.ContainsKey(keyName) ? result.Fields[keyName] : "";

     

                if (dateString.Length > 8) dateString = dateString.Substring(0, 8);

                DateTime.TryParseExact(dateString, "yyyyMMdd", CultureInfo.CurrentCulture, DateTimeStyles.None, out dt);

     

                return dt;

            }

     

    I added this to NodeMapper.cs

  • Sören Deger 733 posts 2844 karma points c-trib
    Apr 16, 2013 @ 12:36
    Sören Deger
    0

    Thank you very much. But where I can find the NodeMapper.cs file?

  • Hasheem Maloo 7 posts 29 karma points
    Apr 16, 2013 @ 12:41
    Hasheem Maloo
    0

    Hey Soren,

    You will need to grab the source code and recompile the dlls.  This is where i got it from:

    http://nforum.codeplex.com/SourceControl/changeset/view/ae8f92ddb261#

  • Sören Deger 733 posts 2844 karma points c-trib
    Apr 16, 2013 @ 13:32
    Sören Deger
    0

    Thank you very much! You're great!

    Sören

  • Snow lizard 36 posts 106 karma points
    Jun 05, 2013 @ 15:27
    Snow lizard
    0

    I can't get this to work, could anyone post the code the code for the NodeMapper.cs file so I can see where i'm going wrong.

    Thanks

  • Brunkage 3 posts 43 karma points
    Jun 12, 2013 @ 14:21
    Brunkage
    0

    Like Hasheem Maloo

    said, you need to add that code to the project and rebuild it.

     

    But if u dont wanna do that, i have made the files already:

    DOWNLOAD HERE:

    http://userhome.org/nForum_date_fix.zip

    Note:

    This only works for nForum 1.6.

     

    Install:

    The only thing you need to do is to paste the 2 dll files into your /bin folder and replace the existing ones.

     

    But maybe its a good idea to take a backup of the 2 dll files before overwriting them...

     

     

    Cheers, The Brunkage

     

  • Hutch White 89 posts 112 karma points
    Jun 13, 2013 @ 20:58
    Hutch White
    0

    Was that the only change necessary?  Changing the NodMapper.cs in the nForum source?  I'm still getting the issue after this update in Umbraco 6.  Any help would be awesome!

  • Tomasz Kowalski 135 posts 445 karma points
    Aug 07, 2013 @ 15:16
    Tomasz Kowalski
    0

    Hi,

    I have the same problem in umbraco 6.1.3 and nForum 1.6. After adding first forum category, I've got this "datetime" error.

    I have replaced these two DLLs with these in to posts above. I have also self recompiled source. I don't get this error now, but I also can't see any categories.

    Any ideas?

    Best regards

    Thomas

  • sagar 13 posts 33 karma points
    Feb 26, 2014 @ 15:01
    sagar
    0

    String was not recognized as a valid DateTime.

    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.FormatException: String was not recognized as a valid DateTime.

    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: 

    [FormatException: String was not recognized as a valid DateTime.]
       System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +10841066
       System.Convert.ToDateTime(String value) +83
       nForum.BusinessLogic.Models.NodeMapper.MapForumCategory(SearchResult nodetomap) +204
       nForum.BusinessLogic.Data.ForumFactory.<ReturnAllCategories>b__8(SearchResult searchResult) +10
       System.Linq.WhereSelectEnumerableIterator`2
    error first time when i create topic it works and after login again gives error

Please Sign in or register to post replies

Write your reply to:

Draft