umbraco / Umbraco.UIBuilder.Issues

Back office UI builder for Umbraco
3 stars 2 forks source link

Adding readonly field twice causes exception during validating on save #105

Closed andrewmckaskill closed 2 months ago

andrewmckaskill commented 3 months ago

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:

  1. Create a collection with two tabs.
  2. Add the same read-only field to both tabs
  3. Add a writeable field to the first tab
  4. Open an entity for editing
  5. Change the writable field
  6. Click save

Expected behavior I should be able to display read-only fields on multiple tabs and save any other updatable fields.

Screenshots image

Environment (please complete the following information):

.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)

acoumb commented 2 months ago

Hi @andrewmckaskill ,

Issue has been fixed with latest patch release of UIBuilder - 13.1.5

Regards, Adrian