Remap custom created visitor groups?

Vote:
 

Hi!

We are refactoring some code and and changing namespace on our visitor groups. This makes the startup crash with this exception:

[ArgumentNullException: Värde får inte vara null.
Parameternamn: key]
   System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument) +52
   System.Collections.Generic.Dictionary`2.FindEntry(TKey key) +342
   System.Collections.Generic.Dictionary`2.ContainsKey(TKey key) +21
   EPiServer.Data.Dynamic.Providers.Internal.DbDataStoreProvider.ProcessValueFromDb(Type targetType, Object value, String name, ProviderCallContext context, Type targetParentType) +137
   EPiServer.Data.Dynamic.Providers.SqlServerDataStoreProvider.ProcessValueFromDb(Type targetType, Object value, String name, ProviderCallContext context, Type targetParentType) +460
   EPiServer.Data.Dynamic.Providers.Internal.DbDataStoreProvider.LoadInlineProperties(ProviderCallContext ctx) +596
   EPiServer.Data.Dynamic.Providers.Internal.<>c__DisplayClass37_0.<Load>b__0() +21
   EPiServer.Data.Providers.Internal.<>c__DisplayClass31_0`1.<Execute>b__0() +70
   EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute(Func`1 method) +78
   EPiServer.Data.Dynamic.DynamicDataStore.InternalLoad(Identity id, Type type, LoadAsObjectType loadAs, ProviderCallContext parentContext) +614
   EPiServer.Data.Dynamic.Providers.Internal.DbDataStoreProvider.LoadSubObject(Identity id, Type type, String storeName, ProviderCallContext context) +300
   EPiServer.Data.Dynamic.Providers.Internal.DbDataStoreProvider.LoadReferencesAndCollections(ProviderCallContext ctx) +2241
   EPiServer.Data.Dynamic.Providers.Internal.DbDataStoreProvider.LoadObject(ProviderCallContext context) +150
   EPiServer.Data.Providers.Internal.<>c__DisplayClass31_0`1.<Execute>b__0() +70
   EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute(Func`1 method) +78
   EPiServer.Data.Dynamic.DynamicDataStore.InternalLoad(Identity id, Type type, LoadAsObjectType loadAs, ProviderCallContext parentContext) +614
   EPiServer.Data.Dynamic.Providers.Internal.DbDataStoreProvider.LoadSubObject(Identity id, Type type, String storeName, ProviderCallContext context) +300
   EPiServer.Data.Dynamic.Providers.Internal.DbDataStoreProvider.LoadReferenceMarkers(IList list, ProviderCallContext context) +119
   EPiServer.Data.Dynamic.Providers.Internal.DbDataStoreProvider.LoadCollection(ProviderCallContext context, PropertyMap propertyMap) +2203
   EPiServer.Data.Dynamic.Providers.Internal.DbDataStoreProvider.LoadReferencesAndCollections(ProviderCallContext ctx) +2409
   EPiServer.Data.Dynamic.Providers.Internal.DbDataStoreProvider.LoadObject(ProviderCallContext context) +150
   EPiServer.Data.Providers.Internal.<>c__DisplayClass31_0`1.<Execute>b__0() +70
   EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute(Func`1 method) +78
   EPiServer.Data.Dynamic.DynamicDataStore.InternalLoad(Identity id, Type type, LoadAsObjectType loadAs, ProviderCallContext parentContext) +614
   EPiServer.Data.Dynamic.Internal.EPiServerDynamicDataStore.Load(Identity id) +66
   EPiServer.Data.Dynamic.Internal.DynamicDataCollectionEnumerator.get_Current() +335
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +506
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +69
   EPiServer.Personalization.VisitorGroups.Internal.VisitorGroupStore.List() +291
   EPiServer.Personalization.VisitorGroups.VisitorGroupInitialization.InitializeStoredVisitorGroups(IServiceLocator locator) +183

[TargetInvocationException: Ett undantagsfel har inträffat i målet för en aktivering.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +221
   System.Delegate.DynamicInvokeImpl(Object[] args) +159
   EPiServer.Framework.Initialization.InitializationEngine.OnInitComplete() +263
   EPiServer.Framework.Initialization.InitializationEngine.ExecuteTransition(Boolean continueTransitions) +208
   EPiServer.Framework.Initialization.InitializationModule.EngineExecute(HostType hostType, Action`1 engineAction) +423
   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +231
   EPiServer.Global..ctor() +42
   Web.Global..ctor() +37
   ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\21c45c3a\da84c660\App_global.asax.h86ewgqw.0.cs:0

[TargetInvocationException: Ett undantagsfel har inträffat i målet för en aktivering.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +194
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +100
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1485
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +298
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +26
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +80
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +182
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369

[HttpException (0x80004005): Ett undantagsfel har inträffat i målet för en aktivering.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +626
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +114
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +724

My guess is that I need to remap the vistor groups in the db, can that be done with changing namespace directly in the database?

Could I use the EPiServerDataStore attribute maybe?

Thanks!

/Kristoffer

#294137
Edited, Jan 04, 2023 14:26
Vote:
 

Hi!

Got this from Episerver support and it solved my problem.

Please run the following call on your local DB first ( you can keep the backup of local as well ) and if everything works then later you can raise a ticket with us if you want to run it on any other environment.
 
exec [dbo].[BigTableDeleteAll] 'VW_VisitorGroup'

/Kristoffer

#294962
Jan 19, 2023 13:09
Vote:
 

Hi

I had the same issue, not on initialization though, but when trying to create/update visitor groups created based on these custom criterion. The front end of the site throws "Failed To Bind Model" error on Vist\itorGroup/Save or Update POST calls :

And in logs, i see the same Value is null exception :

System.ArgumentNullException: Value cannot be null. (Parameter 'type')
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at EPiServer.Cms.UI.VisitorGroups.Api.Builders.VisitorGroupDtoBuilder.GetSettingsFromCriterionModel(VisitorGroupCriterion criterion)
   at EPiServer.Cms.UI.VisitorGroups.Api.Builders.VisitorGroupDtoBuilder.Build(VisitorGroupCriterion criterion, String translatedCategory)
   at System.Linq.Enumerable.SelectListIterator`2.MoveNext()
   at System.Text.Json.Serialization.Converters.IEnumerableDefaultConverter`2.OnWriteResume(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
   at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryWrite(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
   at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
   at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
   at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
   at System.Text.Json.Serialization.JsonConverter`1.WriteCoreAsObject(Utf8JsonWriter writer, Object value, JsonSerializerOptions options, WriteStack& state)
   at System.Text.Json.JsonSerializer.WriteCore[TValue](JsonConverter jsonConverter, Utf8JsonWriter writer, TValue& value, JsonSerializerOptions options, WriteStack& state)
   at System.Text.Json.JsonSerializer.WriteStreamAsync[TValue](Stream utf8Json, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
   at System.Text.Json.JsonSerializer.WriteStreamAsync[TValue](Stream utf8Json, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
   at System.Text.Json.JsonSerializer.WriteStreamAsync[TValue](Stream utf8Json, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonOutputFormatter.WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)
   at EPiServer.Formatters.Internal.ExtendedSystemTextJsonOutputFormatter.WriteAsync(OutputFormatterWriteContext context, ResponseDecorator responseDecorator)
   at EPiServer.Shell.Web.Mvc.JsonDataResult.ExecuteResultAsync(ActionContext context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultAsync>g__Logged|22_0(ResourceInvoker invoker, IActionResult result)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|30_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()

I tried the above suggestion from Epi on local DB, but it essentially deleted all my existing visitor groups (which i see as a problem on an upgrade site where original live site has several Visitor groups created and assigned to content). And i can't create any new ones using custom criterion still because of the same error as above.

Please advice!

Regards

Ritu

#295003
Jan 19, 2023 20:21
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.