Copied to clipboard

Flag this post as spam?

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


  • TheSharpieOne 10 posts 84 karma points
    May 30, 2016 @ 19:23
    TheSharpieOne
    0

    Copy Form - Duplicating Form GUID

    I created a form and copied it. It ended up breaking the UI when it tries to call http://localhost/umbraco/backoffice/UmbracoForms/FormSecurity/GetByUserId?userId=0 when viewing any form. The call returns:

    Sequence contains more than one matching element
     at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate) at Umbraco.Forms.Web.Editors.FormSecurityController.GetByUserId(Int32 userId) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) 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.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()
    

    Looking into it I see that the UFUserFormSecurity table now has a row with a duplicate guid.

    Ids 6 and 7 are the same

    The duplicated row seems to be extra and not needed (it is just adding the same data twice)

    Manually deleting the one with the Id of 7 in the DB fixes the error.

  • Daniël Knippers 109 posts 777 karma points MVP 2x c-trib
    May 31, 2016 @ 06:55
    Daniël Knippers
    0

    Hi TheSharpieOne,

    Thank you for the detailed report.

    Does this happen with every form consistently? I cannot reproduce this issue locally, copying a form does not seem to cause any issues and there are no duplicate rows in the database.

    Do you see multiple XHR calls in the console as well related to copying a form? Our API method is /umbraco/backoffice/api/PerplexUmbracoForm/CopyByGuid?guid=....

    Regards,

    Daniël

  • TheSharpieOne 10 posts 84 karma points
    May 31, 2016 @ 15:15
    TheSharpieOne
    0

    I thought I was able to make it happen consistently (I got it to happen 4 times in a row), but when I went to do a screen recording of the steps, it didn't happen...

    But going through the process when it did occur, I don't believe it to be this project's issues as the copy method doesn't add the new form to the UFUserFormSecurity table. From what I noticed, after I copy a form, if I run a query, the new form guid is not in the table. Only after I view a different form in the backoffice does it get added to the UFUserFormSecurity table. This call is in UmbracoForms. I'm going to open an issue with UmbracoForms.

  • Daniël Knippers 109 posts 777 karma points MVP 2x c-trib
    Jun 01, 2016 @ 06:52
    Daniël Knippers
    0

    It is possible our code which copies the form needs to be updated as well. We do use Umbraco's methods to copy a form, but it is of course possible we need to add code to explicitly update the UFUserFormSecurity table. For reference, the source of our Copy method is here.

    Before you open an issue with UmbracoForms, please make sure you can reproduce this bug in a plain Umbraco Forms 4.3 beta, without our package installed.

    I will try to investigate this issue a bit more later this week.

  • Paul Wright (suedeapple) 255 posts 657 karma points
    Jun 16, 2016 @ 16:34
    Paul Wright (suedeapple)
    0

    I'm getting the same problem too.

    And it only began happening when I tried to copy a form.

    I was logged into the backoffice in two different browsers at the same time. So maybe something got duplicated via out of synch local caching????

  • Daniël Knippers 109 posts 777 karma points MVP 2x c-trib
    Jun 20, 2016 @ 10:02
    Daniël Knippers
    0

    Does this happen as well without our Package? We do not actually add data to UFUserFormSecurity table ourselves, this is (supposedly) done by the Umbraco Forms method FormStorage.InsertForm and/or FormStorage.UpdateForm, which we both call as you can see in the source I referenced earlier.

    I believe vanilla UmbracoForms now also provides a Copy-feature, so if you can reproduce the behavior there (without our package installed) we can assume it is not caused by this package. If you cannot, however, I should do some more tests as we might be using the methods provided by UmbracoForms in a wrong way which causes the duplication.

Please Sign in or register to post replies

Write your reply to:

Draft