You are viewing limited content. For full access, please sign in.

Question

Question

Forms 11: "An item with the same key has already been added" when reviewing completed task

asked on February 14 Show version history

We have a form (modern design) that has several tabs and a few collections as well. The form is submitted by an anonymous user, then a similar form with a few additional fields is used by a licensed user to review the submission. Sometimes, the reviewer needs to see the form again in their Completed Tasks but when they go there, some of the forms cannot be viewed again. The forms client displays the error:

Laserfiche Forms has encountered a problem.

An unexpected error has occurred. [LFF502-UnexpectedError]

A review of the Admin log in Event Viewer on the Forms server shows this message:

Inner exception: System.ArgumentException
Message: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Laserfiche.Forms.Routing.ModernFormTokenGenerator.BuildRepeatableToken(Dictionary`2& tokenDict)
   at Laserfiche.Forms.Routing.ModernFormTokenGenerator.BuildDataSetTokens(XmlDocument xml, Dictionary`2& tokenDict)
   at Laserfiche.Forms.Routing.ModernFormTokenGenerator.GenerateFromXml(XmlDocument xml, cf_users submitter, ParseTokenOptions options)
   at E_Forms.Classes.ModernFormDataProvider.GetFormsInfo(Boolean prevXml, NameValueCollection retainCollection)
   at E_Forms.Models.ViewModels.ModernForm.ModernFormRendererModel.ConstructFormInfo(FormSetting formSetting, Boolean prevXml, NameValueCollection retainCollection)
   at E_Forms.Models.ViewModels.ModernForm.ModernFormRendererModel.RetrieveFormInfoFromSubmission(Int32 submissionId, Int32 rawInstanceId, Int32 currentUser, String redirectUrl, Boolean viewSubmission)
   at E_Forms.Controllers.FormController.AVSubmission(String routingResumeId, Int32 instanceId, Int32 submissionId, Boolean clientHandlesRedirect, String oldResumeId, Boolean readonly, Boolean outsideInbox)
   at lambda_method(Closure , ControllerBase , Object[] )
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass11_0.<InvokeActionMethodFilterAsynchronouslyRecursive>b__0()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass11_2.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass11_2.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass3_6.<BeginInvokeAction>b__4()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass3_1.<BeginInvokeAction>b__1(IAsyncResult asyncResult)

 

Not sure where to go from here. The user is only trying to view a form already submitted, so there's no data being submitted. Not sure how a duplicate key could be created when nothing should be created.

This error is very, very difficult to reproduce as it only happens on some of the submitted forms.

0 0

Replies

replied on February 17

Hi Adam, we are investigating this issue and we could reproduce it if there is address/geolocation field added to collection/table, and there is field rule to hide these fields. And it only happened occationally.

Can you please check if your form has similiar designs?

0 0
replied on February 18

Yes! Our form contains exactly that. It's a student registration form, there's a collection for people to add one or more parent/guardians and each parent has an address field within that collection.

0 0
replied on February 18

Then that's it. We will fix it in next release, sorry for the inconvenice.

The workaround is to set field rules to save data when hide those fields:

0 0
replied on April 8

Hi, this issue has been fixed on Forms 12 Spring 2025 Release. (BugID: 576944)

You can see other changes from: Laserfiche 12 Release Information

Get the latest Laserfiche Forms 12 package from: Laserfiche 12 - Downloads

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.