Error importing

May 2, 2011 at 10:16 PM

Attempting to import BlogML exported from blogengine.net 1.6 into Orchard 1.1 via BlogML module 0.6. The .xml file i'm importing is about a meg in size. Error below, any ideas?

A duplicate value cannot be inserted into a unique index. [ Table name = Orchard_Tags_TagsPartRecord,Constraint name = PK__Orchard_Tags_TagsPartRecord__000000000000028F ]

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 = Orchard_Tags_TagsPartRecord,Constraint name = PK__Orchard_Tags_TagsPartRecord__000000000000028F ]

Source Error:

Line 70: 
Line 71:         public CommentPart CreateComment(CreateCommentContext context, bool moderateComments) {
Line 72:             var comment = _orchardServices.ContentManager.Create<CommentPart>("Comment");
Line 73: 
Line 74:             comment.Record.Author = context.Author;
Coordinator
May 3, 2011 at 8:40 PM

Hey Jowie,

Never seen this one before!!! I have one or two fixes to release around Tags... but never seen this error occuring before.

Would you mind emailing me the BlogML file to Jetski5822 at Hotmail dot Com?? so I can debug and let you know what i find??

Cheers, Nick

May 5, 2011 at 7:29 PM

Sent!

Thanks!

Coordinator
May 7, 2011 at 9:44 AM

Thanks dude,

I have been looking in to this for about a day now, and im still unclear as to why the error occurs. The problem is actually on the line where it creates a draft blog post - and the error occurs at the same place each time... So its very easy to reproduce... I will keep looking!!!

Cheers, Nick

Coordinator
May 7, 2011 at 10:44 AM

It looks like there is a bug in Orchard... Its quite an odd one... basically this

Service.ContentManage.Create("BlogPost")

acts differently to

Service.ContentManage.Create<BlogPost>("BlogPost")

I need to investigate further.. but I have also found a datetime issue that ive fixed in the mean time.

Coordinator
May 7, 2011 at 11:41 AM

I can confirm that was the problem!!!... Not a nice one ot debug.

I managed to get your blog to import against a SQL Server Database with no problems, though I recieve timeouts against SQL CE...

What DB are you using?

May 7, 2011 at 5:27 PM
Edited May 11, 2011 at 10:59 PM
SQL CE :)
Coordinator
May 11, 2011 at 9:37 PM

Can you try now Jowie? I have added Bertrands changes to turn the upload Async which deals with large blogs alot better..,... SQL CE and all :)

LEt me know how you get on

Cheers, Nick

May 11, 2011 at 10:59 PM
Edited May 11, 2011 at 11:04 PM

Again, thanks for all the help. Upgraded to v0.8 of the module and now get:

Server Error in '/' Application.


Sequence contains no matching element

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.InvalidOperationException: Sequence contains no matching element

Source Error:

 

Line 15:         public void ImportTags(ContentItem contentItem, BlogMLBlog blogMLBlog, BlogMLPost blogMLPost) {

Line 16:             var tags = blogMLPost.Categories.ToArray().Cast<BlogMLCategoryReference>()

Line 17:                 .Select(t => blogMLBlog.Categories.First(c => c.Title.Equals(t.Ref, StringComparison.CurrentCultureIgnoreCase)));

Line 18:

Line 19:             foreach (var tag in tags) {


Source File: <SNIP!>\wwwroot\Modules\NGM.BlogML\Core\CommentItemStratagies\TagContentItem.cs Line: 17

Stack Trace:

 

[InvalidOperationException: Sequence contains no matching element]

   System.Linq.Enumerable.First(IEnumerable`1 source, Func`2 predicate) +278

   NGM.BlogML.Core.ContentTypeStrategies.<>c__DisplayClass4.<ImportTags>b__0(BlogMLCategoryReference t) in <SNIP!>\wwwroot\Modules\NGM.BlogML\Core\CommentItemStratagies\TagContentItem.cs:17

   System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +151

   NGM.BlogML.Core.ContentTypeStrategies.TagContentItem.ImportTags(ContentItem contentItem, BlogMLBlog blogMLBlog, BlogMLPost blogMLPost) in <SNIP!>\wwwroot\Modules\NGM.BlogML\Core\CommentItemStratagies\TagContentItem.cs:19

   NGM.BlogML.Core.ContentTypeStrategies.BlogPostContentType.ImportRelatedContentItems(ImportPart importPart, BlogMLBlog blogMLBlog, BlogMLPost blogMLPost, BlogPostPart blogPostPart) in <SNIP!>\wwwroot\Modules\NGM.BlogML\Core\ContentTypeStrategies\BlogPostContentType.cs:147

   NGM.BlogML.Core.ContentTypeStrategies.BlogPostContentType.Import(ImportPart importPart, BlogPart parentBlogPart, BlogMLBlog blogMlBlog, BlogMLPost blogMLPost) in <SNIP!>\wwwroot\Modules\NGM.BlogML\Core\ContentTypeStrategies\BlogPostContentType.cs:74

   NGM.BlogML.Services.ScheduledBlogMLImport.ImportBatch(IEnumerable`1 batch, ImportPart importPart, BlogMLBlog blogMLBlog, Nullable`1 parentBlogId) in <SNIP!>\wwwroot\Modules\NGM.BlogML\Services\ScheduledBlogMLImport.cs:47

 

[TargetInvocationException: Exception has been thrown by the target of an invocation.]

   System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0

   System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +72

   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +251

   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +28

   Orchard.Events.DefaultOrchardEventBus.TryInvokeMethod(IEventHandler eventHandler, Type interfaceType, String methodName, IDictionary`2 arguments, IEnumerable& returnValue) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Events\DefaultOrchardEventBus.cs:82

   Orchard.Events.DefaultOrchardEventBus.TryInvoke(IEventHandler eventHandler, String interfaceName, String methodName, IDictionary`2 arguments, IEnumerable& returnValue) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Events\DefaultOrchardEventBus.cs:71

   Orchard.Events.DefaultOrchardEventBus.TryNotifyHandler(IEventHandler eventHandler, String messageName, String interfaceName, String methodName, IDictionary`2 eventData, Boolean failFast, IEnumerable& returnValue) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Events\DefaultOrchardEventBus.cs:60

   Orchard.Events.<NotifyHandlers>d__0.MoveNext() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Events\DefaultOrchardEventBus.cs:39

   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +217

   System.Linq.Enumerable.ToArray(IEnumerable`1 source) +78

   Orchard.Events.DefaultOrchardEventBus.Notify(String messageName, IDictionary`2 eventData) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Events\DefaultOrchardEventBus.cs:25

Orchard.Environment.State.DefaultProcessingEngine.Execute(Entry entry) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\State\DefaultProcessingEngine.cs:97

   Orchard.Environment.State.DefaultProcessingEngine.ExecuteNextTask() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\State\DefaultProcessingEngine.cs:67

   Orchard.Environment.DefaultOrchardHost.EndRequest() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\DefaultOrchardHost.cs:174

   Orchard.Environment.DefaultOrchardHost.Orchard.Environment.IOrchardHost.EndRequest() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\DefaultOrchardHost.cs:75

   Orchard.WarmupStarter.Starter.OnEndRequest() in d:\TeamCity\Projects\Orchard-Default\src\Orchard.Startup\Starter.cs:35

   Orchard.Web.MvcApplication.Application_EndRequest() in d:\TeamCity\Projects\Orchard-Default\src\Orchard.Web\Global.asax.cs:28

 

[TargetInvocationException: Exception has been thrown by the target of an invocation.]

   System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0

   System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +72

   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +335

   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +28

   System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19

   System.Web.Util.ArglessEventHandlerProxy.Callback(Object sender, EventArgs e) +57

   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148

   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

 


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

Coordinator
May 12, 2011 at 6:50 AM
Argh!!! I see the bug.. Bertrand introduced the bug... darn, I will fix it at work. Give me till 12 :-)

Jowie <notifications@codeplex.com> wrote:



> From: Jowie
>
> Thanks again for all the help.Upgraded to 0.8 and now get a new error:Server Error in '/' Application.Sequence contains no matching elementDescription: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.InvalidOperationException: Sequence contains no matching element
>
> Source Error:
> Line 15: public void ImportTags(ContentItem contentItem, BlogMLBlog blogMLBlog, BlogMLPost blogMLPost) {Line 16: var tags = blogMLPost.Categories.ToArray().Cast<BlogMLCategoryReference>()Line 17: .Select(t => blogMLBlog.Categories.First(c => c.Title.Equals(t.Ref, StringComparison.CurrentCultureIgnoreCase)));Line 18: Line 19: foreach (var tag in tags) {
>
> Source File: \\p-unc-01\content$\jowie.com\wwwroot\Modules\NGM.BlogML\Core\CommentItemStratagies\TagContentItem.cs Line: 17
>
> Stack Trace:
> [InvalidOperationException: Sequence contains no matching element]System.Linq.Enumerable.First(IEnumerable`1 source, Func`2 predicate) +278NGM.BlogML.Core.ContentTypeStrategies.<>c__DisplayClass4.<ImportTags>b__0(BlogMLCategoryReference t) in \\p-unc-01\content$\jowie.com\wwwroot\Modules\NGM.BlogML\Core\CommentItemStratagies\TagContentItem.cs:17System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +151NGM.BlogML.Core.ContentTypeStrategies.TagContentItem.ImportTags(ContentItem contentItem, BlogMLBlog blogMLBlog, BlogMLPost blogMLPost) in \\p-unc-01\content$\jowie.com\wwwroot\Modules\NGM.BlogML\Core\CommentItemStratagies\TagContentItem.cs:19NGM.BlogML.Core.ContentTypeStrategies.BlogPostContentType.ImportRelatedContentItems(ImportPart importPart, BlogMLBlog blogMLBlog, BlogMLPost blogMLPost, BlogPostPart blogPostPart) in \\p-unc-01\content$\jowie.com\wwwroot\Modules\NGM.BlogML\Core\ContentTypeStrategies\BlogPostContentType.cs:147NGM.BlogML.Core.ContentTypeStrategies.BlogPostContentType.Import(ImportPart importPart, BlogPart parentBlogPart, BlogMLBlog blogMlBlog, BlogMLPost blogMLPost) in \\p-unc-01\content$\jowie.com\wwwroot\Modules\NGM.BlogML\Core\ContentTypeStrategies\BlogPostContentType.cs:74NGM.BlogML.Services.ScheduledBlogMLImport.ImportBatch(IEnumerable`1 batch, ImportPart importPart, BlogMLBlog blogMLBlog, Nullable`1 parentBlogId) in \\p-unc-01\content$\jowie.com\wwwroot\Modules\NGM.BlogML\Services\ScheduledBlogMLImport.cs:47[TargetInvocationException: Exception has been thrown by the target of an invocation.]System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +72System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +251System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +28Orchard.Events.DefaultOrchardEventBus.TryInvokeMethod(IEventHandler eventHandler, Type interfaceType, String methodName, IDictionary`2 arguments, IEnumerable& returnValue) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Events\DefaultOrchardEventBus.cs:82Orchard.Events.DefaultOrchardEventBus.TryInvoke(IEventHandler eventHandler, String interfaceName, String methodName, IDictionary`2 arguments, IEnumerable& returnValue) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Events\DefaultOrchardEventBus.cs:71Orchard.Events.DefaultOrchardEventBus.TryNotifyHandler(IEventHandler eventHandler, String messageName, String interfaceName, String methodName, IDictionary`2 eventData, Boolean failFast, IEnumerable& returnValue) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Events\DefaultOrchardEventBus.cs:60Orchard.Events.<NotifyHandlers>d__0.MoveNext() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Events\DefaultOrchardEventBus.cs:39System.Linq.Buffer`1..ctor(IEnumerable`1 source) +217System.Linq.Enumerable.ToArray(IEnumerable`1 source) +78Orchard.Events.DefaultOrchardEventBus.Notify(String messageName, IDictionary`2 eventData) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Events\DefaultOrchardEventBus.cs:25Orchard.Environment.State.DefaultProcessingEngine.Execute(Entry entry) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\State\DefaultProcessingEngine.cs:97Orchard.Environment.State.DefaultProcessingEngine.ExecuteNextTask() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\State\DefaultProcessingEngine.cs:67Orchard.Environment.DefaultOrchardHost.EndRequest() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\DefaultOrchardHost.cs:174Orchard.Environment.DefaultOrchardHost.Orchard.Environment.IOrchardHost.EndRequest() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\DefaultOrchardHost.cs:75Orchard.WarmupStarter.Starter.OnEndRequest() in d:\TeamCity\Projects\Orchard-Default\src\Orchard.Startup\Starter.cs:35Orchard.Web.MvcApplication.Application_EndRequest() in d:\TeamCity\Projects\Orchard-Default\src\Orchard.Web\Global.asax.cs:28[TargetInvocationException: Exception has been thrown by the target of an invocation.]System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +72System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +335System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +28System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19System.Web.Util.ArglessEventHandlerProxy.Callback(Object sender, EventArgs e) +57System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
> Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1-JowieFrom: Jetski5822 [email removed]
> Sent: Wednesday, May 11, 2011 2:37 PM
> To: Joe Carlson
> Subject: Re: Error importing [OrchardBlogML:256068]From: Jetski5822Can you try now Jowie? I have added Bertrands changes to turn the upload Async which deals with large blogs alot better..,... SQL CE and all :)LEt me know how you get onCheers, Nick
>
>
May 12, 2011 at 3:19 PM

No rush! J Thanks again!

From: Jetski5822 [email removed]
Sent: Wednesday, May 11, 2011 11:50 PM
To: Joe Carlson
Subject: Re: Error importing [OrchardBlogML:256068]

From: Jetski5822

Argh!!! I see the bug.. Bertrand introduced the bug... darn, I will fix it at work. Give me till 12 :-)

Coordinator
May 13, 2011 at 2:49 PM

All there... your blog went in nicely to SQL CE....

Nick

May 13, 2011 at 4:17 PM

Got the 0.81 v and tried again. Got a new error, but assume its peculiarities of my particular host. Any way I can increase the timeout?

 

Server Error in '/' Application.

SQL Server Compact timed out waiting for a lock. The default lock time is 2000ms for devices and 5000ms for desktops. The default lock timeout can be increased in the connection string using the ssce: default lock timeout property. [ Session id = 5,Thread id = 26096,Process id = 15104,Table name = Orchard_Framework_ContentItemRecord,Conflict type = x lock (x blocks),Resource = PAG (idx): 1065 ]

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.SqlCeLockTimeoutException: SQL Server Compact timed out waiting for a lock. The default lock time is 2000ms for devices and 5000ms for desktops. The default lock timeout can be increased in the connection string using the ssce: default lock timeout property. [ Session id = 5,Thread id = 26096,Process id = 15104,Table name = Orchard_Framework_ContentItemRecord,Conflict type = x lock (x blocks),Resource = PAG (idx): 1065 ]

Source Error:

Line 64:             
Line 65:             MapContentToBodyPart(blogPost.As<BodyPart>(), postContent);
Line 66:             Services.ContentManager.Create(blogPost, VersionOptions.Draft);
Line 67: 
Line 68:             if (blogMLPost.Approved) {
Coordinator
May 13, 2011 at 6:42 PM

Wow havent seen this one yet!!... Hmm i got your blog imported fine in to Sql CE... Could you try again? Might be a one off?

May 13, 2011 at 8:46 PM

Yea I think its a problem on the host side. Tried again and got: 

<fieldset>

502 - Web server received an invalid response while acting as a gateway or proxy server.

There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.

</fieldset>

They recommend I switch to SQL instead of using SQL CE, so I think I'll have to ask them to provision a DB for me and try that instead.

Thanks for all the help!