When a new field facet is added to a facet group without selecting a Field, an error will occur that will leave the facet group's configuration screen blank when opened again. As a result the facet group can no longer be edited in the UI.
Steps to reproduce
- Open the configuration screen of a facet group
- Add new field facet.
- Leave the Field dropdown without a value
- Press OK and 'Save and close' the facet group configuration
- Reopen the facet group configuration. It will now be completely blank of data.
This behaviour is observed in v9.12.5 and v9.17.5. Is it fixed in a newer version?
I agree that it makes little sense to create a field facet that does not point at a field, but we have a client that has started to make the facets before the fields, which is why this error has been observed. See the error below.
Kind regards
Roald
Error
{"Message":"An error has occurred.","ExceptionMessage":"Value cannot be null.\r\nParameter name: key","ExceptionType":"System.ArgumentNullException","StackTrace":" at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)\r\n at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)\r\n at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)\r\n at Dynamicweb.Indexing.Querying.Faceting.FacetGroupHelper.ConvertToFacets(XElement obj)\r\n at Dynamicweb.Indexing.Querying.QueryService.LoadFacets(String fileName)\r\n at Dynamicweb.Admin.FacetsController.GetFacets(String repository, String item)\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"}