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

User with start folders set results in a SqlException "Operand type clash: uniqueidentifier is incompatible with int" #1050

Closed
corsini-iodigital opened this issue Jul 18, 2023 · 5 comments

Comments

@corsini-iodigital
Copy link

Hi!

Reproduction

Bug summary

Enabling a (forms) start folder for a user seems to break the filter on the listed forms and (sub)folders in the Forms section. The same error also shows if you want to save a form (probably as there is no (correct) parent folder reference).

Removing the start folders causes this to work as expected, except that there's no filter on the folders.
This stopped working after upgrading Umbraco from 10.5.1 to 10.6.1 and Umbraco Forms from 10.3.3 to 10.4.0.

Specifics

Umbraco 10.6.1
Umbraco Forms 10.4.0

This doesn't seem to be browser related. And it can be reproduced on several environments, and also in another project where we don't actively use Forms. Haven't tried a clean install but assume the same error would pop up there.

Steps to reproduce

  • Add one or more Start folders to a certain backoffice user - either on user level or group level (same effect)
  • Browse to the Forms section
  • Open the Forms folder in the tree on the left side
  • A red backoffice error notification pops up and no (sub)folders nor forms are displayed

Expected result

The tree with the forms should be filtered based on the forms start folders.

Actual result

image

Exception:
{"errorMsg":"Failed to retrieve data for child nodes undefined","data":{"ExceptionMessage":"Operand type clash: uniqueidentifier is incompatible with int","ExceptionType":"Microsoft.Data.SqlClient.SqlException, Microsoft.Data.SqlClient, Version=3.0.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5","StackTrace":" at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)\r\n at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)\r\n at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\r\n at Microsoft.Data.SqlClient.SqlDataReader.TryConsumeMetaData()\r\n at Microsoft.Data.SqlClient.SqlDataReader.get_MetaData()\r\n at Microsoft.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)\r\n at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)\r\n at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method)\r\n at Microsoft.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)\r\n at Microsoft.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)\r\n at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteDbDataReader(CommandBehavior behavior) in C:\\projects\\dotnet\\src\\MiniProfiler.Shared\\Data\\ProfiledDbCommand.cs:line 216\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func1 func)\r\n at NPoco.Database.ExecuteReaderHelper(DbCommand cmd)\r\n at NPoco.Database.ExecuteDataReader(DbCommand cmd, Boolean sync)\r\n at NPoco.Database.QueryImp[T](T instance, Expression1 listExpression, Func2 idFunc, Sql Sql, PocoData pocoData)+MoveNext()\r\n at System.Collections.Generic.List1..ctor(IEnumerable1 collection)\r\n at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)\r\n at System.Linq.Enumerable.SelectEnumerableIterator2.MoveNext()\r\n at Umbraco.Extensions.EnumerableExtensions.SelectByGroups[TResult,TSource](IEnumerable1 source, Func2 selector, Int32 groupSize)+MoveNext()\r\n at System.Linq.Enumerable.SelectEnumerableIterator2.ToArray()\r\n at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)\r\n at Umbraco.Cms.Core.Cache.NoCacheRepositoryCachePolicy2.GetAll(TId[] ids, Func2 performGetAll)\r\n at Umbraco.Forms.Core.Services.BaseService3.Get(Guid[] ids)\r\n at Umbraco.Forms.Core.Security.FormsSecurity.FilterFormIdsForUser(IEnumerable1 formIds, IUser user)\r\n at Umbraco.Forms.Core.Security.FormsSecurity.FilterFormIdsForCurrentUser(IEnumerable1 formIds)\r\n at Umbraco.Forms.Web.Trees.FormTreeController.GetFoldersAndForms(FormCollection queryStrings, FormTreeAccess treeAccess, String path)\r\n at Umbraco.Forms.Web.Trees.FormTreeController.GetTreeNodes(String id, FormCollection queryStrings)\r\n at Umbraco.Cms.Web.BackOffice.Trees.TreeControllerBase.GetTreeNodesAsync(String id, FormCollection queryStrings)\r\n at Umbraco.Cms.Web.BackOffice.Trees.TreeControllerBase.GetNodes(String id, FormCollection queryStrings)\r\n at lambda_method2026(Closure , Object )\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask)\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\r\n--- End of stack trace from previous location ---\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)"},"status":500,"xhrStatus":"complete"}`

@corsini-iodigital
Copy link
Author

Side question: could a downgrade of Umbraco Forms back to 10.3.3 potentially be a workaround for now, and is that possible? Of course, still needs to be confirmed this is actually a bug.
Thanks in advance!

@AndyButland
Copy link

Hi @corsini-iodigital - I'll take a look at this tomorrow to see if I can see what's gone wrong in this update. In the meantime, you can downgrade. Sometimes this is tricky as you hit an error about the database not recognising the current state, which requires a database query to update. But actually there's been no database changes in Forms between the versions you updated between, so you shouldn't have this problem.

@AndyButland
Copy link

This will be resolved in the next releases.

Internal note: was not visible with the latest code, and can see has been resolved already in this PR.

@corsini-iodigital
Copy link
Author

Thanks @AndyButland! H5YR!

Is there already an ETA for 10.5.0?

Cheers,
Chris

@AndyButland
Copy link

Am aiming to get the RC out in a week or so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants