Describe the bug
Adding a readonly field more than once (even if on different tabs) to a collection causes a InvalidOperationException when saving, while validating the entity.
Steps To Reproduce
Steps to reproduce the behavior:
Create a collection with two tabs.
Add the same read-only field to both tabs
Add a writeable field to the first tab
Open an entity for editing
Change the writable field
Click save
Expected behavior
I should be able to display read-only fields on multiple tabs and save any other updatable fields.
Screenshots
Environment (please complete the following information):
Server OS: Mac OS 14.3
Browser [e.g. chrome, safari]: Brave
Umbraco Version [e.g. 9.0.0]: 13.3.1
Product Version [e.g. 1.0.0]:
dotnet --info:
.NET SDK:
Version: 8.0.101
Commit: 6eceda187b
Workload version: 8.0.100-manifests.69afb982
Runtime Environment:
OS Name: Mac OS X
OS Version: 14.3
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/8.0.101/
.NET workloads installed:
Workload version: 8.0.100-manifests.69afb982
There are no installed workloads to display.
Host:
Version: 8.0.1
Architecture: arm64
Commit: bf5e279d92
.NET SDKs installed:
6.0.408 [/usr/local/share/dotnet/sdk]
7.0.203 [/usr/local/share/dotnet/sdk]
8.0.101 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.16 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.16 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
x64 [/usr/local/share/dotnet/x64]
registered at [/etc/dotnet/install_location_x64]
Environment variables:
Not set
global.json file:
Not found
Stack Trace:
System.InvalidOperationException, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e: Sequence contains more than one matching element
at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException()
at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable1 source, Func2 predicate, Boolean& found)
at System.Linq.Enumerable.Single[TSource](IEnumerable1 source, Func2 predicate)
at Umbraco.UIBuilder.Web.WebApi.Validation.EntityValidator.ValidatePropertyData(ModelStateDictionary modelState, EntityPostModel postModel, EditorFieldConfig[] configProps, Object entity, EditorMode editorMode)
at Umbraco.UIBuilder.Web.WebApi.Validation.EntityValidator.Validate(CollectionConfig collectionConfig, ModelStateDictionary modelState, EntityPostModel postModel, Object entity, EditorMode editorMode)
at Umbraco.UIBuilder.Web.Controllers.Api.UIBuilderApiController.SaveEntity(EntityPostModel postModel)
at lambda_method900(Closure, Object, Object[])
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.gLogged|12_1(ControllerActionInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Describe the bug Adding a readonly field more than once (even if on different tabs) to a collection causes a InvalidOperationException when saving, while validating the entity.
Steps To Reproduce Steps to reproduce the behavior:
Expected behavior I should be able to display read-only fields on multiple tabs and save any other updatable fields.
Screenshots
Environment (please complete the following information):
Stack Trace: System.InvalidOperationException, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e: Sequence contains more than one matching element at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException() at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerablegLogged|12_1(ControllerActionInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
1 source, Func
2 predicate, Boolean& found) at System.Linq.Enumerable.Single[TSource](IEnumerable1 source, Func
2 predicate) at Umbraco.UIBuilder.Web.WebApi.Validation.EntityValidator.ValidatePropertyData(ModelStateDictionary modelState, EntityPostModel postModel, EditorFieldConfig[] configProps, Object entity, EditorMode editorMode) at Umbraco.UIBuilder.Web.WebApi.Validation.EntityValidator.Validate(CollectionConfig collectionConfig, ModelStateDictionary modelState, EntityPostModel postModel, Object entity, EditorMode editorMode) at Umbraco.UIBuilder.Web.Controllers.Api.UIBuilderApiController.SaveEntity(EntityPostModel postModel) at lambda_method900(Closure, Object, Object[]) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.