v6.0.5 SqlCe - A duplicate value cannot be inserted into a unique index
It's the first time that I've tried uSync, so this is one of those - "I'm not sure if it's me, or I've found a bug" moments.
For testing it out, I've got a fresh Umbraco 6.0.5 (using SQL CE), with the Standard Website MVC starter kit installed (no other packages installed).
Then I installed "uSync_1.3.2_Umbraco6.zip" ... which then threw a YSoD.
Server Error in '/' Application.
A duplicate value cannot be inserted into a unique index. [ Table name = cmsDocumentType,Constraint name = PK_cmsDocumentType ]
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.Data.SqlServerCe.SqlCeException: A duplicate value cannot be inserted into a unique index. [ Table name = cmsDocumentType,Constraint name = PK_cmsDocumentType ]
Source Error:
Line 1359: throw;
Line 1360: }
Line 1361: }
Line 1362:
Line 1363: // Insert an annotated poco object
Source File: c:\VCS\Umbraco\Core\src\Umbraco.Core\Persistence\PetaPoco.cs Line: 1361
Stack Trace:
[SqlCeException (0x80004005): A duplicate value cannot be inserted into a unique index. [ Table name = cmsDocumentType,Constraint name = PK_cmsDocumentType ]]
System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr) +269
System.Data.SqlServerCe.SqlCeCommand.ExecuteCommandText(IntPtr& pCursor, Boolean& isBaseTableCursor) +670
System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options) +474
System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery() +44
Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco) in c:\VCS\Umbraco\Core\src\Umbraco.Core\Persistence\PetaPoco.cs:1361
Umbraco.Core.Persistence.Database.Insert(Object poco) in c:\VCS\Umbraco\Core\src\Umbraco.Core\Persistence\PetaPoco.cs:1367
Umbraco.Core.Persistence.Repositories.ContentTypeRepository.PersistUpdatedItem(IContentType entity) in c:\VCS\Umbraco\Core\src\Umbraco.Core\Persistence\Repositories\ContentTypeRepository.cs:254
Umbraco.Core.Persistence.Repositories.RepositoryBase`2.PersistUpdatedItem(IEntity entity) in c:\VCS\Umbraco\Core\src\Umbraco.Core\Persistence\Repositories\RepositoryBase.cs:206
Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit() in c:\VCS\Umbraco\Core\src\Umbraco.Core\Persistence\UnitOfWork\PetaPocoUnitOfWork.cs:109
Umbraco.Core.Services.ContentTypeService.Save(IEnumerable`1 contentTypes, Int32 userId) in c:\VCS\Umbraco\Core\src\Umbraco.Core\Services\ContentTypeService.cs:164
Umbraco.Core.Services.PackagingService.ImportContentTypes(XElement element, Boolean importStructure, Int32 userId) in c:\VCS\Umbraco\Core\src\Umbraco.Core\Services\PackagingService.cs:240
umbraco.cms.businesslogic.packager.Installer.ImportDocumentType(XmlNode n, User u, Boolean ImportStructure) in c:\VCS\Umbraco\Core\src\umbraco.cms\businesslogic\Packager\Installer.cs:939
jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path, Boolean structure) in c:\VCS\Umbraco\Community\Collaboration\uSync\jumps.umbraco.usync\SyncDocType.cs:157
jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path, Boolean structure) in c:\VCS\Umbraco\Community\Collaboration\uSync\jumps.umbraco.usync\SyncDocType.cs:164
jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path, Boolean structure) in c:\VCS\Umbraco\Community\Collaboration\uSync\jumps.umbraco.usync\SyncDocType.cs:164
jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path, Boolean structure) in c:\VCS\Umbraco\Community\Collaboration\uSync\jumps.umbraco.usync\SyncDocType.cs:164
jumps.umbraco.usync.SyncDocType.ReadAllFromDisk() in c:\VCS\Umbraco\Community\Collaboration\uSync\jumps.umbraco.usync\SyncDocType.cs:123
jumps.umbraco.usync.uSync.ReadAllFromDisk() in c:\VCS\Umbraco\Community\Collaboration\uSync\jumps.umbraco.usync\uSync.cs:164
jumps.umbraco.usync.uSync.RunSync() in c:\VCS\Umbraco\Community\Collaboration\uSync\jumps.umbraco.usync\uSync.cs:243
jumps.umbraco.usync.uSync.DoOnStart() in c:\VCS\Umbraco\Community\Collaboration\uSync\jumps.umbraco.usync\uSync.cs:71
Umbraco.Core.CoreBootManager.<Complete>b__5(IApplicationEventHandler x) in c:\VCS\Umbraco\Core\src\Umbraco.Core\CoreBootManager.cs:153
Umbraco.Core.EnumerableExtensions.ForEach(IEnumerable`1 items, Action`1 action) in c:\VCS\Umbraco\Core\src\Umbraco.Core\EnumerableExtensions.cs:91
Umbraco.Core.CoreBootManager.Complete(Action`1 afterComplete) in c:\VCS\Umbraco\Core\src\Umbraco.Core\CoreBootManager.cs:152
Umbraco.Web.WebBootManager.Complete(Action`1 afterComplete) in c:\VCS\Umbraco\Core\src\Umbraco.Web\WebBootManager.cs:110
Umbraco.Core.UmbracoApplicationBase.StartApplication(Object sender, EventArgs e) in c:\VCS\Umbraco\Core\src\Umbraco.Core\UmbracoApplicationBase.cs:35
Umbraco.Core.UmbracoApplicationBase.Application_Start(Object sender, EventArgs e) in c:\VCS\Umbraco\Core\src\Umbraco.Core\UmbracoApplicationBase.cs:48
[HttpException (0x80004005): A duplicate value cannot be inserted into a unique index. [ Table name = cmsDocumentType,Constraint name = PK_cmsDocumentType ]]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +12863325
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +175
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475
[HttpException (0x80004005): A duplicate value cannot be inserted into a unique index. [ Table name = cmsDocumentType,Constraint name = PK_cmsDocumentType ]]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12880068
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12721257
(I tried to debug it - downloaded the uSync source and put in the Umbraco core PDB files - that's why the filepaths are different)
From debugging uSync, the problem happens at `SyncDocType.cs` line 157:
Pretty sure we fix this already - as in U4-2112. It might not have made it into 6.0.x yet. As far as I remember 6.0.5 only contained security updates, but not sure as it was Sebastiaan who spearheaded that release.
Might be worth trying it with latest 6.0.6 nightly to verify whether the issue still exists.
Sorry to say, I don't think it's fixed. I used "UmbracoCms.6.0.6-build.44.zip" nightly.
Did the same steps: fresh install, IIS Express, SQL CE, installed Standard Website MVC, checked the site was working, then installed uSync and boom! :-(
Here's the exception, (same as before - but without all the PDB debug details)
Server Error in '/' Application.
A duplicate value cannot be inserted into a unique index. [ Table name = cmsDocumentType,Constraint name = PK_cmsDocumentType ]
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.Data.SqlServerCe.SqlCeException: A duplicate value cannot be inserted into a unique index. [ Table name = cmsDocumentType,Constraint name = PK_cmsDocumentType ]
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:
[SqlCeException (0x80004005): A duplicate value cannot be inserted into a unique index. [ Table name = cmsDocumentType,Constraint name = PK_cmsDocumentType ]]
System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr) +269
System.Data.SqlServerCe.SqlCeCommand.ExecuteCommandText(IntPtr& pCursor, Boolean& isBaseTableCursor) +670
System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options) +474
System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery() +44
Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco) in c:\Program Files (x86)\teamcity\buildAgent\work\e145e9ed82478b40\src\Umbraco.Core\Persistence\PetaPoco.cs:1361
Umbraco.Core.Persistence.Database.Insert(Object poco) in c:\Program Files (x86)\teamcity\buildAgent\work\e145e9ed82478b40\src\Umbraco.Core\Persistence\PetaPoco.cs:1367
Umbraco.Core.Persistence.Repositories.ContentTypeRepository.PersistUpdatedItem(IContentType entity) in c:\Program Files (x86)\teamcity\buildAgent\work\e145e9ed82478b40\src\Umbraco.Core\Persistence\Repositories\ContentTypeRepository.cs:254
Umbraco.Core.Persistence.Repositories.RepositoryBase`2.PersistUpdatedItem(IEntity entity) in c:\Program Files (x86)\teamcity\buildAgent\work\e145e9ed82478b40\src\Umbraco.Core\Persistence\Repositories\RepositoryBase.cs:207
Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit() in c:\Program Files (x86)\teamcity\buildAgent\work\e145e9ed82478b40\src\Umbraco.Core\Persistence\UnitOfWork\PetaPocoUnitOfWork.cs:107
Umbraco.Core.Services.ContentTypeService.Save(IEnumerable`1 contentTypes, Int32 userId) in c:\Program Files (x86)\teamcity\buildAgent\work\e145e9ed82478b40\src\Umbraco.Core\Services\ContentTypeService.cs:166
Umbraco.Core.Services.PackagingService.ImportContentTypes(XElement element, Boolean importStructure, Int32 userId) in c:\Program Files (x86)\teamcity\buildAgent\work\e145e9ed82478b40\src\Umbraco.Core\Services\PackagingService.cs:242
jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path, Boolean structure) +337
jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path, Boolean structure) +400
jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path, Boolean structure) +400
jumps.umbraco.usync.SyncDocType.ReadFromDisk(String path, Boolean structure) +400
jumps.umbraco.usync.SyncDocType.ReadAllFromDisk() +127
jumps.umbraco.usync.uSync.ReadAllFromDisk() +228
jumps.umbraco.usync.uSync.RunSync() +239
jumps.umbraco.usync.uSync.DoOnStart() +138
Umbraco.Core.EnumerableExtensions.ForEach(IEnumerable`1 items, Action`1 action) in c:\Program Files (x86)\teamcity\buildAgent\work\e145e9ed82478b40\src\Umbraco.Core\EnumerableExtensions.cs:89
Umbraco.Core.CoreBootManager.Complete(Action`1 afterComplete) in c:\Program Files (x86)\teamcity\buildAgent\work\e145e9ed82478b40\src\Umbraco.Core\CoreBootManager.cs:156
Umbraco.Web.WebBootManager.Complete(Action`1 afterComplete) +31
[HttpException (0x80004005): A duplicate value cannot be inserted into a unique index. [ Table name = cmsDocumentType,Constraint name = PK_cmsDocumentType ]]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +12863325
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +175
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475
[HttpException (0x80004005): A duplicate value cannot be inserted into a unique index. [ Table name = cmsDocumentType,Constraint name = PK_cmsDocumentType ]]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12880068
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12721257
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18033
This isn't urgent for me... I was purely trying out uSync. If there is anything you'd like me to test, etc. Let me know.
I'd be surprised if the issue descriped in U4-2112 had resurfaced, but it looks like its related to the cmsDocumentType and not the cmsContentTypeAllowedContentType table :( We have a test running for installing the package xml from the Standard Mvc website starterkit, which runs against sql ce and works without any problems. So not quite sure what is triggering this exception.
I'm not 100% sure of the steps that uSync takes when first installed. (I'm hoping Kevin can clarify that)
It seems to make an export of all the DocTypes, Templates, etc okay. But then it tries to import them back in, it falls over on the DocType's "Allowed Templates" part. (At least that's as far as I got trying to debug it)
I don't think it's exactly the same as "U4-2112", but that was the closest issue I could find for it. I'm happy to raise a new issue for this? (I just wanted to make sure I wasn't misusing uSync)
I've had a look, and the failure happens when uSync calles Installer.ImportDocumentType for the Base\ContentMaster\Standard document type.
as Lee said it's Allowed Templates - I've removed all the allowed templates and added them back one at a time - if fails on any allowed template except for it's self. which is why I think we though this was resolved last time, creating a single doctype, checking it, adding it self to allowed types and running the ImportDocumentType function works.
with the Standard MVC Starter kit , you get a YSOD of 6.0.4 also.
v6.0.5 SqlCe - A duplicate value cannot be inserted into a unique index
It's the first time that I've tried uSync, so this is one of those - "I'm not sure if it's me, or I've found a bug" moments.
For testing it out, I've got a fresh Umbraco 6.0.5 (using SQL CE), with the Standard Website MVC starter kit installed (no other packages installed).
Then I installed "uSync_1.3.2_Umbraco6.zip" ... which then threw a YSoD.
(I tried to debug it - downloaded the uSync source and put in the Umbraco core PDB files - that's why the filepaths are different)
From debugging uSync, the problem happens at `SyncDocType.cs` line 157:
Following it through to the Umbraco core, it seems to fall over when trying to insert the "Allowed Templates" for the "Standard" doc-type.
My gut feeling is that this is an Umbraco core bug - along the lines of U4-2112.
... that is, unless I'm missing something obvious?
Thanks, Lee.
Pretty sure we fix this already - as in U4-2112. It might not have made it into 6.0.x yet. As far as I remember 6.0.5 only contained security updates, but not sure as it was Sebastiaan who spearheaded that release.
Might be worth trying it with latest 6.0.6 nightly to verify whether the issue still exists.
- Morten
Cool - thanks for looking at this Morten. I'll give a nightly a try.
Sorry to say, I don't think it's fixed. I used "UmbracoCms.6.0.6-build.44.zip" nightly.
Did the same steps: fresh install, IIS Express, SQL CE, installed Standard Website MVC, checked the site was working, then installed uSync and boom! :-(
Here's the exception, (same as before - but without all the PDB debug details)
This isn't urgent for me... I was purely trying out uSync. If there is anything you'd like me to test, etc. Let me know.
Cheers, Lee.
So the error occurs as soon as you install uSync?
I'd be surprised if the issue descriped in U4-2112 had resurfaced, but it looks like its related to the cmsDocumentType and not the cmsContentTypeAllowedContentType table :(
We have a test running for installing the package xml from the Standard Mvc website starterkit, which runs against sql ce and works without any problems. So not quite sure what is triggering this exception.
- Morten
I'm not 100% sure of the steps that uSync takes when first installed. (I'm hoping Kevin can clarify that)
It seems to make an export of all the DocTypes, Templates, etc okay. But then it tries to import them back in, it falls over on the DocType's "Allowed Templates" part. (At least that's as far as I got trying to debug it)
I don't think it's exactly the same as "U4-2112", but that was the closest issue I could find for it. I'm happy to raise a new issue for this? (I just wanted to make sure I wasn't misusing uSync)
Thanks, Lee.
I suspect its a problem with the DocumentType / Template (foreign key) reference that exists in the cmsDocumentType table.
Yup, please add an issue to the tracker.
Thanks Morten - added to issue tracker: http://issues.umbraco.org/issue/U4-2270
Just a heads up - I have the same problem on 6.1.0 beta2.
I've had a look, and the failure happens when uSync calles Installer.ImportDocumentType for the Base\ContentMaster\Standard document type.
as Lee said it's Allowed Templates - I've removed all the allowed templates and added them back one at a time - if fails on any allowed template except for it's self. which is why I think we though this was resolved last time, creating a single doctype, checking it, adding it self to allowed types and running the ImportDocumentType function works.
with the Standard MVC Starter kit , you get a YSOD of 6.0.4 also.
Thanks, this is now working in the latest 6.0.6 nightly build.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.