Copied to clipboard

Flag this post as spam?

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


  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    May 24, 2013 @ 16:29
    Lee Kelleher
    0

    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:

    Installer.ImportDocumentType(node, User.GetUser(0), structure);

    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.

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    May 24, 2013 @ 16:36
    Morten Christensen
    1

    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

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    May 24, 2013 @ 16:38
    Lee Kelleher
    0

    Cool - thanks for looking at this Morten.  I'll give a nightly a try.

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    May 24, 2013 @ 16:56
    Lee Kelleher
    0

    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.

    Cheers, Lee.

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    May 24, 2013 @ 17:02
    Morten Christensen
    0

    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

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    May 24, 2013 @ 17:07
    Lee Kelleher
    0

    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.

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    May 24, 2013 @ 17:08
    Morten Christensen
    0

    I suspect its a problem with the DocumentType / Template (foreign key) reference that exists in the cmsDocumentType table.

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    May 24, 2013 @ 17:09
    Morten Christensen
    0

    Yup, please add an issue to the tracker.

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    May 24, 2013 @ 17:18
    Lee Kelleher
    0

    Thanks Morten - added to issue tracker: http://issues.umbraco.org/issue/U4-2270

  • Tom Fulton 2030 posts 4998 karma points c-trib
    May 24, 2013 @ 19:14
    Tom Fulton
    1

    Just a heads up - I have the same problem on 6.1.0 beta2.

  • Kevin Jump 2310 posts 14695 karma points MVP 7x c-trib
    May 25, 2013 @ 11:34
    Kevin Jump
    0

    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. 

  • Kevin Jump 2310 posts 14695 karma points MVP 7x c-trib
    May 29, 2013 @ 15:07
    Kevin Jump
    2

    Thanks, this is now working in the latest 6.0.6 nightly build. 

Please Sign in or register to post replies

Write your reply to:

Draft