I'm having a weird problem with Forms (Umbraco v.7.14.0). Periodically I am finding that a user is unable to create a new form - the panel to create the form is simply blank on clicking 'Create a new form' -> 'Empty form'.
In the logs I see this error:
2019-04-02 16:57:45,348 [P34280/D3/T208] ERROR Umbraco.Forms.Web.Editors.FormSecurityController - Unhandled controller exception occurred
System.InvalidOperationException: 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)
which is weird because I can see in the database that the user that I'm logged in as has no obvious duplicate in the umbracoUser table.
The only solution I've found, which isn't really a solution, is to disable the user and modify their email address, and create another user with their correct email address, which solves the problem.
OK, found the issue. It occurs when there are duplicate rows in the UFUserFormSecurity table ie. when a user is assigned to the same form more than once.
You can determine if there are duplicates by running the following SQL:
SELECT [User], [Form], COUNT(*) FROM UFUserFormSecurity
GROUP BY [User], [Form]
HAVING COUNT(*) > 1
ORDER BY [User]
(As an aside, why on Earth is User a varchar column???)
You need to delete the duplicates and then restart the site (touch web.config) to fix this.
User cannot create a new Form
Hi,
I'm having a weird problem with Forms (Umbraco v.7.14.0). Periodically I am finding that a user is unable to create a new form - the panel to create the form is simply blank on clicking 'Create a new form' -> 'Empty form'.
In the logs I see this error:
2019-04-02 16:57:45,348 [P34280/D3/T208] ERROR Umbraco.Forms.Web.Editors.FormSecurityController - Unhandled controller exception occurred System.InvalidOperationException: 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)
which is weird because I can see in the database that the user that I'm logged in as has no obvious duplicate in the
umbracoUser
table.The only solution I've found, which isn't really a solution, is to disable the user and modify their email address, and create another user with their correct email address, which solves the problem.
Has anyone else come across this?
OK, found the issue. It occurs when there are duplicate rows in the
UFUserFormSecurity
table ie. when a user is assigned to the same form more than once.You can determine if there are duplicates by running the following SQL:
(As an aside, why on Earth is User a varchar column???)
You need to delete the duplicates and then restart the site (touch
web.config
) to fix this.Getting this same error on 8.6.1 with no dupes in db.
is working on a reply...