Copied to clipboard

Flag this post as spam?

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


  • Steve Bridges 51 posts 72 karma points
    Oct 16, 2013 @ 23:33
    Steve Bridges
    0

    Problem with keyvalueprevalueEditor Dataresolver (Fix included!)

    We are having an issue transferring datatypes that use the KeyValuePrevalueEditor DataResolver in Courier 2.7 with Umbraco 6.1.1.  We’ve upgraded to the latest nightly build of Courier (2.7.8.16) and the issue persists.  We have been able to track the issue as far as a call to

     

    PersistenceManager.Default.RetrieveItem<DataType>( itemId);

     

    When this method is called the Prevalues that are returned all have an Id of 0.  The Alias, SortOrder and Value do match the cmsDataTypePreValues, just the Id is wrong.  It appears that this Id is used by the DataResolver to set the value for Courier to transfer.  The end result is that the value is always an empty string.  A review of the Umbraco.Courier.Persistence.V6.NHibernate.dll seems to indicate that the Id is not being set.  Below is a  screenshot showing the issue in action with the application paused just after the call to RetrieveItem.   

    We will manually create our own fix - however, we'd greatly appreciate a fix in the core product!!

  • Tristan Stahnke 2 posts 22 karma points
    Oct 29, 2013 @ 01:52
    Tristan Stahnke
    0

    Steve,

    We are seeing this issue as well. You mentioned there's a fix included; are there updated dlls/diffs available for this? 

    What's interesting is dropdowns using custom controls instead of the standard KeyValue pair seems to transfer using courier just fine.

  • Jonathan Bailer 2 posts 22 karma points
    Oct 29, 2013 @ 13:50
    Jonathan Bailer
    0

    Hi Tristan,

    We used ILSpy to modify the Umbraco.Courier.Persistence.V6.NHibernate.dll.  The problem area is near the end of the RetrieveItem method in the loop which assigns all the Prevalues (it is highlighted in the screenshot Steve posted).  The fixed version of that loop is below.

     

          foreach (CmsDataTypePreValue dataTypePreValue in Enumerable.Where((IEnumerable) currentSession.CreateCriteria().List(), (Func) (x => x.DatatypeNodeId == dt.UmbracoNode.Id)))

            dataType.Prevalues.Add(new DataTypePrevalue()

            {

              Value = dataTypePreValue.Value,

              Alias = dataTypePreValue.Alias,

              SortOrder = dataTypePreValue.Sortorder,

              Id = dataTypePreValue.Id

            });

  • Tristan Stahnke 2 posts 22 karma points
    Oct 29, 2013 @ 20:48
    Tristan Stahnke
    0

    How did I not know about ILSpy? Thanks much, that was really helpful!

  • Nick 101 posts 123 karma points
    Mar 04, 2014 @ 18:03
    Nick
    0

    How do I modifly and save the DLL?

    Or did you create a class that overrides this? 

  • Jonathan Bailer 2 posts 22 karma points
    Mar 04, 2014 @ 22:39
    Jonathan Bailer
    0

    Hi Nick. We used ILSpy to decompile the DLL then made the change and recompiled it. We overwrite the original file with our updated version. I should note that we ended up dropping Courier from this project due to issues similar to this repeatedly cropping up so we haven't been able to test the long term effects of this change. YMMV

  • Nick 101 posts 123 karma points
    Mar 14, 2014 @ 16:58
    Nick
    0

    Okay I managed to decompile and recompile however I get this during couriering:

    System.InvalidCastException: Unable to cast object of type 'System.Int32' to type 'System.String'. at Umbraco.Courier.Persistence.V6.NHibernate.Persisters.DocumentItem.RetrieveItem[T]

    Seems like Id is sometimes a string or something isn't casting properly

     

     

     

     

     

  • Nick 101 posts 123 karma points
    Mar 14, 2014 @ 18:31
    Nick
    0

    I found the bug

    I had to change Document.cs in Persisters.DocumentItem line 142 to:

    document1.CourierFileName = cmsDocument.Text + (object) "_" + cmsDocument.UmbracoNode.Id.ToString();

    and now it works!

    Is anyone from the courier development team seeing this??? 

  • Gerty Engrie 130 posts 490 karma points c-trib
    Jul 10, 2014 @ 20:28
    Gerty Engrie
    0

    Hi, 

    Jonathan's fix seems to work for me, but i would like to add that this only works when your datatype is being saved as an integer, when it is set to nvarchar or text this fix does not seem to work. Don't know if anyone ever created a support ticket? I just did :) 

    Gerty

Please Sign in or register to post replies

Write your reply to:

Draft