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 ?
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.
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.
[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
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 ?
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.
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.
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..
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
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?
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?
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 ?
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).
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?
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 ?
It goes a bit like this...
Just as an aside, the write & attach work perfectly fine. I see files getting generated & looking correct.
yeah looks like it's failing quite early, any chance you can zip the usync folder up and send it to me ?
Kevin
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.
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
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>
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)
Okay, and this xml results in an error similar to the one listed above?
- Morten
yep. this
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
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
usync does this (structure is passed false/true from the caller)
i suspect the problem is me calling the function that is now ..
?
do i need to call this diffrently than i currently do ?
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
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
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
So you are still left with an error in 6.0.4?
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..
On 6.0.4 it works more but I have a new error : (
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.
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
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?
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
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 ?
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
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.
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?
put this in issues http://issues.umbraco.org/issue/U4-2112 for reference.
is working on a reply...