So basically, I created a doctype in attach mode. Then I deleted the doctype and created it as a child of another one.
This causes a massive crash when the app starts. .net doesnt even give a meaningful error message. Below is my even error log. So basically I think what you could do is: if the doctype was already synched, then skip it, and log it.
Exception information:
Exception type: HttpException
Exception message: An item with the same key has already been added.
at System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app)
at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)
at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context)
at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)
An item with the same key has already been added.
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path)
at jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path)
at jumps.umbraco.usync.SyncDocType.ReadAllFromDisk()
at jumps.umbraco.usync.uSync.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)
So did the usync folder end up with two .config files for the same doctype in different places? it should delete one of them when you delete the doctype - if it does that moves should work, because it just changes the parent type during the import.
The error is from usync not checking before it adds the doctype to its internal dictionary object that is used for a second pass during the import - (i should fix that, so it only syncs the first one it finds)
If added better (e.g some) error checking for multiple doctypes, so that shouldn't happen again.
I can't replicate uSync leaving a rouge .config file on disk but I've added a bit more debugging around the delete to see if I can trap it next time it happens.
yes that's basically what it now does, because of the structure elements uSync does a two pass install for doctypes, first putting them in, then making sure the structure and any removed properties are property sorted. So now it doesn't add the type to the second pass details if it's already been done.
templates and datatypes are added in one pass, so it doesn't actually sort what's been added, if something appears twice on disk then the last one should always win ? (in theory)
I have the same issue, I removed all references, folders/dll's config file from the solution and installed your latest NuGet package and on first creation of items it runs into this issue. Can you help me out please? This is a production site we want to merge doctypes on
Crash on multiple doctype defs
Umbraco 6.1.6, usync 1.5.7
So basically, I created a doctype in attach mode. Then I deleted the doctype and created it as a child of another one.
This causes a massive crash when the app starts. .net doesnt even give a meaningful error message. Below is my even error log. So basically I think what you could do is: if the doctype was already synched, then skip it, and log it.
Exception information:
Exception type: HttpException
Exception message: An item with the same key has already been added.
at System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app)
at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)
at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context)
at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)
An item with the same key has already been added.
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path)
at jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path)
at jumps.umbraco.usync.SyncDocType.ReadAllFromDisk()
at jumps.umbraco.usync.uSync.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)
So did the usync folder end up with two .config files for the same doctype in different places? it should delete one of them when you delete the doctype - if it does that moves should work, because it just changes the parent type during the import.
The error is from usync not checking before it adds the doctype to its internal dictionary object that is used for a second pass during the import - (i should fix that, so it only syncs the first one it finds)
I dont know how it ended up with 2 files but yes.
If added better (e.g some) error checking for multiple doctypes, so that shouldn't happen again.
I can't replicate uSync leaving a rouge .config file on disk but I've added a bit more debugging around the delete to see if I can trap it next time it happens.
v1.5.8 updated on our and nuget now.
i think if you just check to see if it's already added the doctype, that should be fine.
Should probably also do that for templates, datatypes etc
yes that's basically what it now does, because of the structure elements uSync does a two pass install for doctypes, first putting them in, then making sure the structure and any removed properties are property sorted. So now it doesn't add the type to the second pass details if it's already been done.
templates and datatypes are added in one pass, so it doesn't actually sort what's been added, if something appears twice on disk then the last one should always win ? (in theory)
Sounds good!
Thanks for the good work!
Hi,
I have the same issue, I removed all references, folders/dll's config file from the solution and installed your latest NuGet package and on first creation of items it runs into this issue. Can you help me out please? This is a production site we want to merge doctypes on
Best,
Matt.
is working on a reply...