Copied to clipboard

Flag this post as spam?

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


  • Rodske 74 posts 104 karma points
    Apr 01, 2013 @ 23:16
    Rodske
    0

    Error with read in Umbraco 6.0.3 + uSync 1.1.2

     

    From a clean install after a few new document types, whenever I go to read from it errors with the follow YSOD.

    File-level perms are all good. Any ideas what's going wrong?

    [NullReferenceException: Object reference not set to an instance of an object.]
       Umbraco.Core.Services.PackagingService.ImportContentTypes(XElement element, Int32 userId) +641
       jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path, Boolean structure) +336
       jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path, Boolean structure) +397
       jumps.umbraco.usync.SyncDocType.ReadAllFromDisk() +126
       jumps.umbraco.usync.uSync.RunSync() +280
       jumps.umbraco.usync.uSync.DoOnStart() +99
       Umbraco.Core.EnumerableExtensions.ForEach(IEnumerable`1 items, Action`1 action) +147
       Umbraco.Core.CoreBootManager.Complete(Action`1 afterComplete) +143
       Umbraco.Web.WebBootManager.Complete(Action`1 afterComplete) +30

     

  • Kevin Jump 2311 posts 14696 karma points MVP 7x c-trib
    Apr 01, 2013 @ 23:38
    Kevin Jump
    0

    uSync does do some additional logging that might give more info. in 6.0.3 this is written to disk . \App_Data\Logs\UmbracoTracelog.txt - can you look in their and see if it can isolate the doctype that is causing hte failure ? 

  • Rodske 74 posts 104 karma points
    Apr 01, 2013 @ 23:51
    Rodske
    0

    It goes a bit like this...

    2013-04-01 22:13:34,232 [5] INFO  umbraco.BusinessLogic.Log - [Thread 7] Redirected log call (please use Umbraco.Core.Logging.LogHelper instead of umbraco.BusinessLogic.Log) | Type: Debug | User: 0 | NodeId: 0 | Comment: ========== uSync Starting
    2013-04-01 22:13:34,232 [5] INFO  umbraco.BusinessLogic.Log - [Thread 7] Redirected log call (please use Umbraco.Core.Logging.LogHelper instead of umbraco.BusinessLogic.Log) | Type: Debug | User: 0 | NodeId: 0 | Comment: uSync: Reading from Disk - Starting
    2013-04-01 22:13:34,648 [5] INFO  umbraco.BusinessLogic.Log - [Thread 6] Redirected log call (please use Umbraco.Core.Logging.LogHelper instead of umbraco.BusinessLogic.Log) | Type: Custom | User: 0 | NodeId: 0 | Comment: uSync Starting
    2013-04-01 22:13:35,754 [5] ERROR Umbraco.Core.UmbracoApplicationBase - [Thread 1] An unhandled exception occurred
    System.NullReferenceException: Object reference not set to an instance of an object.
       at Umbraco.Core.Services.PackagingService.ImportContentTypes(XElement element, Int32 userId)
       at jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path, Boolean structure)
       at jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path, Boolean structure)
       at jumps.umbraco.usync.SyncDocType.ReadAllFromDisk()
       at jumps.umbraco.usync.uSync.RunSync()
       at jumps.umbraco.usync.uSync.DoOnStart()
       at Umbraco.Core.EnumerableExtensions.ForEach[TItem](IEnumerable`1 items, Action`1 action)
       at Umbraco.Core.CoreBootManager.Complete(Action`1 afterComplete)
       at Umbraco.Web.WebBootManager.Complete(Action`1 afterComplete)
  • Rodske 74 posts 104 karma points
    Apr 01, 2013 @ 23:52
    Rodske
    0

    Just as an aside, the write & attach work perfectly fine. I see files getting generated & looking correct.

  • Kevin Jump 2311 posts 14696 karma points MVP 7x c-trib
    Apr 02, 2013 @ 19:32
    Kevin Jump
    0

    yeah looks like it's failing quite early, any chance you can zip the usync folder up and send it to me ? 

    Kevin 

  • Kevin Jump 2311 posts 14696 karma points MVP 7x c-trib
    Apr 03, 2013 @ 20:07
    Kevin Jump
    0

    HI 

    I've managed to re-create the error, it looks like its a consequence of the Package Import services being moved across to the new API in umbraco 6.0.3 - i've just done a quick search and i think this is effecting a few packages too.

    Some fixes have been made for v6.0.4 so i just downloaded the latest nightly - but i am now getting a diffrent error - later in the import. 

    I think i am going to have to step back from uSync v6 release as being stable while some of these issues sort them selves out in the core. I will continue to test and see if i can resolve - but the fundimental problem is the changing API and the fact that uSync is using the v4 import methods. 

    Longer term usync for 6 will use the new API - i just need to be sure the new API isn't going to change all the time before I invest in the dev time. 

     

     

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Apr 03, 2013 @ 21:27
    Morten Christensen
    0

    Does any of you happen to have the XML that errors upon import? Looks like an issue on our part - not checking for something that is obviously null in some imports.

    With the import XML I can create a new test case and isolate the error.

     

    - Morten 

  • Kevin Jump 2311 posts 14696 karma points MVP 7x c-trib
    Apr 03, 2013 @ 21:46
    Kevin Jump
    0

    this is a single doctype at the root. the only doctype on my blank install. it has one property... everything is called test : ) 

     

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>

    <DocumentType>

      <Info>

        <Name>test</Name>

        <Alias>test</Alias>

        <Icon>folder.gif</Icon>

        <Thumbnail>folder.png</Thumbnail>

        <Description>

        </Description>

        <AllowAtRoot>False</AllowAtRoot>

        <AllowedTemplates>

          <Template>test</Template>

        </AllowedTemplates>

        <DefaultTemplate>test</DefaultTemplate>

      </Info>

      <Structure>

        <DocumentType>test</DocumentType>

      </Structure>

      <GenericProperties>

        <GenericProperty>

          <Name>test</Name>

          <Alias>test</Alias>

          <Type>b4471851-82b6-4c75-afa4-39fa9c6a75e9</Type>

          <Definition>fbaf13a8-4036-41f2-93a3-974f678c312a</Definition>

          <Tab>

          </Tab>

          <Mandatory>False</Mandatory>

          <Validation>

          </Validation>

          <Description><![CDATA[]]></Description>

        </GenericProperty>

      </GenericProperties>

      <Tabs />

    </DocumentType>

     

  • Kevin Jump 2311 posts 14696 karma points MVP 7x c-trib
    Apr 03, 2013 @ 21:50
    Kevin Jump
    0

    XML is generated with a call to item.ToXml(xmlDoc) and then imported again with a call to Installer.ImportDocumentType(node,User.GetUser(0), false);

    the code is here in github (https://github.com/KevinJump/jumps.umbraco.usync/blob/master/jumps.umbraco.usync/SyncDocType.cs

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Apr 03, 2013 @ 21:52
    Morten Christensen
    0

    Okay, and this xml results in an error similar to the one listed above?

     

    - Morten

  • Kevin Jump 2311 posts 14696 karma points MVP 7x c-trib
    Apr 03, 2013 @ 21:58
    Kevin Jump
    0

    yep. this 

    [NullReferenceException: Object reference not set to an instance of an object.]
       Umbraco.Core.Services.PackagingService.ImportContentTypes(XElement element, Int32 userId) +435
       umbraco.cms.businesslogic.packager.Installer.ImportDocumentType(XmlNode n, User u, Boolean ImportStructure) +53
       jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path, Boolean structure) +224
       jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path, Boolean structure) +274
       jumps.umbraco.usync.SyncDocType.ReadAllFromDisk() +61
       jumps.umbraco.usync.uSync.RunSync() +257
       jumps.umbraco.usync.uSync.DoOnStart() +111
       jumps.umbraco.usync.uSync.OnApplicationStarted(UmbracoApplicationBase httpApplication, ApplicationContext applicationContext) +5
  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Apr 03, 2013 @ 22:32
    Morten Christensen
    0

    Found the issue in the Installer code rather then the actual import in the PackagingService.
    Fixed in changeset cec40f0c0859 in the 6.0.4 branch.

    http://umbraco.codeplex.com/SourceControl/changeset/9277dcd484d0

    - Morten

  • Kevin Jump 2311 posts 14696 karma points MVP 7x c-trib
    Apr 03, 2013 @ 22:51
    Kevin Jump
    0

    Thanks, but i don't think that will fix the problem for me - i suspect i need to do something similar in uSync. ?

    uSync reads the XML from disk - and calls Installer.ImportDocumentType directly, it doesn't actually call Import, because it's just importing a single document type at a time. 

    bit like this code from 4.11.x/6.0.0 

    foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("DocumentTypes/DocumentType"))
    {
      ImportDocumentType(n, u, false);
      saveNeeded = true;
    }
    

    usync does this (structure is passed false/true from the caller)

    XmlDocument xmlDoc=newXmlDocument();
    xmlDoc.Load(file);
    // get the first node
    XmlNodenode = xmlDoc.SelectSingleNode("//DocumentType");
    if(node!=null)
    {
      // use the umbraco package installer to import
      Installer.ImportDocumentType(node,User.GetUser(0),structure);
    }

     i suspect the problem is me calling the function that is now ..

       public static void ImportDocumentType(XmlNode n, User u, bool ImportStructure)
            {
                var element = n.GetXElement();
                var contentTypes = ApplicationContext.Current.Services.PackagingService.ImportContentTypes(element, u.Id);
    ....
      

    do i need to call this diffrently than i currently do ? 

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Apr 03, 2013 @ 23:06
    Morten Christensen
    0

    I think that should be fine. I'll have to revisit the static ImportDocumentType method tomorrow, but from the looks of it its fine.

    The only problem I could get out of the posted xml was the DocumentType element was wrongfully selected as there is an element with this name under structure.

     

    - Morten

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Apr 03, 2013 @ 23:17
    Morten Christensen
    0

    Maybe I jumped over your xpath selects too quickly, but just to verify: you might have to ensure which DocumentType element is selected so you don't end up passing this xml to the import method: <DocumentType>test</DocumentType>.

    The import method should be able to handle the same type of root elements in v6 as in v4. If that wasn't the case it would be a breaking change. I can also verify this tomorrow (just in case we need extra checks or other fallbacks.

     

    - Morten

  • Kevin Jump 2311 posts 14696 karma points MVP 7x c-trib
    Apr 03, 2013 @ 23:17
    Kevin Jump
    0

    yes i've just tried it and i get diffrent errors in the nightly builds of 6.0.4 it looks like there was a single change in PackagingServices for http://issues.umbraco.org/issue/U4-2024 in this commit http://umbraco.codeplex.com/SourceControl/changeset/ba35ab6d94b1 that I suspect fixes the first error i am seeing in 6.0.3

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Apr 03, 2013 @ 23:19
    Morten Christensen
    0

    So you are still left with an error in 6.0.4?

  • Kevin Jump 2311 posts 14696 karma points MVP 7x c-trib
    Apr 03, 2013 @ 23:20
    Kevin Jump
    0

    it's diffrent but my nightly install is a bit messy after some poking around. I'm going to go back to a clean nightly install and go from first principles to confirm.. 

  • Kevin Jump 2311 posts 14696 karma points MVP 7x c-trib
    Apr 03, 2013 @ 23:36
    Kevin Jump
    0

    On 6.0.4 it works more but I have a new error : ( 

    [SqlCeException (0x80004005): A duplicate value cannot be inserted into a unique index. [ Table name = cmsContentTypeAllowedContentType,Constraint name = PK_cmsContentTypeAllowedContentType ]]
       System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr) +48
       System.Data.SqlServerCe.SqlCeCommand.ExecuteCommandText(IntPtr& pCursor, Boolean& isBaseTableCursor) +297
       System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options) +646
       System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery() +21
       Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco) +1667
       Umbraco.Core.Persistence.Database.Insert(Object poco) +51
       Umbraco.Core.Persistence.Repositories.ContentTypeBaseRepository`2.PersistUpdatedBaseContentType(ContentTypeDto dto, IContentTypeComposition entity) +4473
       Umbraco.Core.Persistence.Repositories.ContentTypeRepository.PersistUpdatedItem(IContentType entity) +767
       Umbraco.Core.Persistence.Repositories.RepositoryBase`2.PersistUpdatedItem(IEntity entity) +48
       Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit() +256
       Umbraco.Core.Services.ContentTypeService.Save(IEnumerable`1 contentTypes, Int32 userId) +262
       Umbraco.Core.Services.PackagingService.ImportContentTypes(XElement element, Int32 userId) +1101
       umbraco.cms.businesslogic.packager.Installer.ImportDocumentType(XmlNode n, User u, Boolean ImportStructure) +53
       jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path, Boolean structure) +224
       jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path, Boolean structure) +274
       jumps.umbraco.usync.SyncDocType.ReadAllFromDisk() +77
       jumps.umbraco.usync.uSync.RunSync() +278
       jumps.umbraco.usync.uSync.DoOnStart() +111
       jumps.umbraco.usync.uSync.OnApplicationStarted(UmbracoApplicationBase httpApplication, ApplicationContext applicationContext) +5

    I've done some testing and this is when "Allowed Child Nodetypes" are selected and the xml contains the <structure> element. remove the <structure> element and it loads. add it back it YSODs

    single doctype in install with the following xml.

     <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <DocumentType>
      <Info>
        <Name>root doc type</Name>
        <Alias>rootDocType</Alias>
        <Icon>folder.gif</Icon>
        <Thumbnail>folder.png</Thumbnail>
        <Description>
        </Description>
        <AllowAtRoot>True</AllowAtRoot>
        <AllowedTemplates>
          <Template>rootDocType</Template>
        </AllowedTemplates>
        <DefaultTemplate>rootDocType</DefaultTemplate>
      </Info>
      <Structure>
        <DocumentType>rootDocType</DocumentType>
      </Structure>
      <GenericProperties />
      <Tabs />
    </DocumentType>
  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Apr 04, 2013 @ 06:45
    Morten Christensen
    0

    This error sounds like you are reimporting the same doc type so the structure already exists or haven't been properly deleted.

    I'll how we can fix this. As far as I remember it won't import doc types that already exists.

    - Morten 

  • Kevin Jump 2311 posts 14696 karma points MVP 7x c-trib
    Apr 04, 2013 @ 08:36
    Kevin Jump
    0

    Yes it is reimporting an existing Doctype. The old ImportDocumentType call did this

    I think it is still importing them but failing on the structure? 

    a quick look, and this has happened to someone importing a package, i guess it also happens if you import the same package twice (indeed it does, i have just confimed this with uBlogsy) ? 

    also if you can't reimport the same doctype package upgrades would fail? 

     

     

     

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Apr 04, 2013 @ 08:49
    Morten Christensen
    0

    Yup, also saw the uBlogsy error and the guy managed to get it installed after cleaning out his site. So it does sound like an issue with the structure. I'll have a look when I get in.

    I'm not sure I understand what you mean by upgrades failing?

     

    - Morten

  • Kevin Jump 2311 posts 14696 karma points MVP 7x c-trib
    Apr 04, 2013 @ 08:51
    Kevin Jump
    0

    if you have a package installed, and install a newer version of the package over the top then you will get the error when it tried to update the doctypes ? 

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Apr 04, 2013 @ 10:09
    Morten Christensen
    1

    I found the issue after running a test with re-importing. The issue in the PackagingService was that it didn't check the existing allowed doc types before adding new ones. It starts off with the "original" list of allowed doc types and then starts adding whatever is in the xml, so it ended up with duplicate entries which of course made the save throw an exception during the db inserts.

    I have corrected this and the code is pushed. This should also resolve the issue from the uBlogsy forum where a guy had a similar issue occur during installation.

    A side note: I mentioned earlier that existing doc types won't be improted. That is not correct (must have been half asleep when I wrote that) - it will of course update the existing doc type (and existing doc types are found by the Alias).

    - Morten

  • Kevin Jump 2311 posts 14696 karma points MVP 7x c-trib
    Apr 04, 2013 @ 11:46
    Kevin Jump
    0

    Cool, I'll double check usync works with the next nightly, and keep and eye on it so it works when 6.0.4 is release. 

     

    thanks. 

  • Kevin Jump 2311 posts 14696 karma points MVP 7x c-trib
    Apr 11, 2013 @ 19:59
    Kevin Jump
    0

    Hello, 

    I've finnaly had some time to play with this, and there still appears to be some issue with 6.0.4 (im looking at nightly 13) and uSync. 

    doctypes can be saved to disk (using SaveToXML) fine and read in (using ImportDocumentType) 

    but still once the structure element is set (Allowed child node types) the next import attempt fails with 

    A duplicate value cannot be inserted into a unique index

    as previous posts

    the same code works on 4.11.6, and as far as i can tell 6.0.0 upto 6.0.2 (i had other problems with prior versions and this dll, but that worked) 

    it looks like the old ImportDocumentType code cleared then re-added the structure, while the new code just tried to add and is causing the error ? 

    was there a ticket for hte last fix ? fell i should probibly be in issues.umbraco.org? 

  • Kevin Jump 2311 posts 14696 karma points MVP 7x c-trib
    Apr 14, 2013 @ 16:55
    Kevin Jump
    0

    put this in issues http://issues.umbraco.org/issue/U4-2112 for reference. 

Please Sign in or register to post replies

Write your reply to:

Draft