Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] InvalidCastException on sync-pack export #237

Closed
benjaminc opened this issue May 19, 2021 · 2 comments
Closed

[BUG] InvalidCastException on sync-pack export #237

benjaminc opened this issue May 19, 2021 · 2 comments
Labels
release/8.9.2 Patch Release

Comments

@benjaminc
Copy link

Describe the bug
When exporting data from my site to create a sync pack, I am getting the error "System.InvalidCastException: Unable to cast object of type 'Newtonsoft.Json.Linq.JArray' to type 'Newtonsoft.Json.Linq.JObject'."

To Reproduce
Steps to reproduce the behavior:

  1. Have invalid property data in your database (from an upgraded previous version, client data access, or many other reasons)
  2. Go to the uSync node in the back office
  3. Go to the Exporter tab
  4. Add content, including the node with invalid data or one of its ancestors
  5. Try to export

Expected behavior
I expect a message is shown indicating a failure has occurred. Best case is that all valid nodes do still export and there would be a report of some kind where you could see the failures and review inline. Next best would be that all valid nodes do still export, and there is at least a message stating that something didn't go right and to check the logs. Worst acceptable case is that the export aborts without exporting other valid nodes upon any error and displays a message stating an error has occurred.

Actual behavior
The export process appears to hang when exporting a single node. No error is displayed, and the export process never finishes, it just displays like it is still exporting, indefinitely.

About your Site (please complete the following information):

  • Umbraco Version: 8.12.2
  • uSync Version: 8.9.3.0
  • Browser: Chrome

Additional context
Here is the full stack trace of the error:

Unhandled controller exception occurred for request '"https://dev.bof.calfire.proworks.xyz/umbraco/backoffice/uSync/uSyncNuExporterApi/CreateExport"'
System.InvalidCastException: Unable to cast object of type 'Newtonsoft.Json.Linq.JArray' to type 'Newtonsoft.Json.Linq.JObject'.
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at uSync8.ContentEdition.Mapping.SyncNestedValueMapperBase.GetJsonValue(Object value)
   at uSync8.ContentEdition.Mapping.Mappers.BlockListMapper.GetExportValue(Object value, String editorAlias)
   at uSync8.ContentEdition.Mapping.SyncValueMapperCollection.GetExportValue(Object value, String editorAlias)
   at uSync8.ContentEdition.Mapping.SyncNestedValueMapperBase.GetExportProperties(JObject item, IContentType docType)
   at uSync8.ContentEdition.Mapping.Mappers.BlockListMapper.GetExportValue(Object value, String editorAlias)
   at uSync8.ContentEdition.Mapping.SyncValueMapperCollection.GetExportValue(Object value, String editorAlias)
   at uSync8.ContentEdition.Serializers.ContentSerializerBase`1.GetExportValue(Object value, PropertyType propertyType, String culture, String segment)
   at uSync8.ContentEdition.Serializers.ContentSerializerBase`1.SerializeProperties(TObject item, SyncSerializerOptions options)
   at uSync8.ContentEdition.Serializers.ContentSerializer.SerializeCore(IContent item, SyncSerializerOptions options)
   at uSync8.BackOffice.SyncHandlers.SyncHandlerRoot`2.Export(TObject item, String folder, HandlerSettings config)
   at uSync8.BackOffice.SyncHandlers.SyncHandlerRoot`2.Export(Udi udi, String folder, HandlerSettings settings)
   at uSync.Expansions.Core.Services.SyncPackService.ExportItem(uSyncDependency dependency, String folder, String handlerSet, SyncPackOptions options)
   at uSync.Expansions.Core.Services.SyncPackService.ExportItems(SyncPackRequest request)
   at uSync.Exporter.Services.SyncExporterService.ExportItems(Guid id, SyncPackRequest request)
   at uSync.Exporter.Controllers.uSyncNuExporterApiController.ProcessExporterSteps(IList`1 steps, ExporterRequest request)
   at lambda_method(Closure , Object , Object[] )
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()
@KevinJump KevinJump added the Investigating Looking at this issue to see if we can identify a root cause label Jun 1, 2021
@KevinJump
Copy link
Owner

added better reporting / handling in Commit : 24297da

@KevinJump KevinJump added release/8.9.2 Patch Release and removed Investigating Looking at this issue to see if we can identify a root cause labels Jun 1, 2021
@KevinJump
Copy link
Owner

hoping the changes in v8.9.2 have caught these edge cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release/8.9.2 Patch Release
Projects
None yet
Development

No branches or pull requests

2 participants