Geta / geta-optimizely-genericlinks

An extensive alternative to LinkItemCollection in Optimizely.
Apache License 2.0
4 stars 0 forks source link

System.InvalidCastException: Unable to cast object of type 'EPiServer.SpecializedProperties.LinkItemCollection' to type 'Geta.Optimizely.GenericLinks.LinkDataCollection`1[Geta.Optimizely.Web.Infrastructure.Cms.IconLinkData]' #3

Closed gatisb closed 2 years ago

gatisb commented 2 years ago

while creating block containing LinkDataCollection

image

System.InvalidCastException: Unable to cast object of type 'EPiServer.SpecializedProperties.LinkItemCollection' to type 'Geta.Optimizely.GenericLinks.LinkDataCollection1[Geta.Optimizely.Web.Infrastructure.Cms.IconLinkData]'. at Castle.Proxies.LinkListBlockProxy.get_Links() at lambda_method861(Closure , Object , Object[] ) at EPiServer.Validation.DataAnnotationsValidator1.ValidateInstance(Object instance, List1 validationResult, ValidationContext validationContext) at EPiServer.Validation.DataAnnotationsValidator1.Validate(T instance) at EPiServer.Validation.Internal.ContextValidatorWrapper2.Validate(Object instance, Object context) at EPiServer.Validation.Internal.ValidationService.ValidateRecursively(Object instance, Object context, HashSet1 visitedInstances) at EPiServer.Validation.Internal.ValidationService.Validate[T](Object instance, T context) at EPiServer.Core.ContentProvider.Validate(IContent content, ContentSaveValidationContext saveValidationContext) at EPiServer.Core.Internal.DefaultContentRepository.Save(IContent content, SaveAction action, AccessLevel access) at EPiServer.Cms.Shell.Service.Internal.ContentService.Save(IContent content, SaveAction saveAction, AccessLevel accessLevel) at EPiServer.Cms.Shell.Service.Internal.ContentService.Save(IContent content, SaveAction saveAction) at EPiServer.Cms.Shell.UI.Rest.ContentChangeManager.CreateContent(ContentReference parentLink, Int32 contentTypeId, Nullable1 resourceFolderId, Boolean createAsLocalAsset, String name, IDictionary2 properties, SaveAction saveAction) at EPiServer.Cms.Shell.UI.Rest.ContentChangeManager.CreateContent(ContentReference parentLink, Int32 contentTypeId, Nullable1 resourceFolderId, Boolean createAsLocalAsset, String name, IDictionary2 properties, Boolean autoPublish) at EPiServer.Cms.Shell.UI.Rest.ContentChangeManager.Create(ContentReference parentLink, Int32 contentTypeId, Nullable1 resourceFolderId, Boolean createAsLocalAsset, String name, IDictionary`2 properties, Boolean autoPublish) at EPiServer.Cms.Shell.UI.Rest.Internal.ContentDataStore.Post(PostContentModel entity) at lambda_method849(Closure , Object , Object[] ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() --- End of stack trace from previous location --- 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|24_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() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Routing.EndpointMiddleware.gAwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) at Geta.Optimizely.Domain.Infrastructure.DynamicRendering.DynamicRendererMiddleware.InvokeAsync(HttpContext context) in C:\projects\site\src\Geta.Domain\Infrastructure\DynamicRendering\DynamicRenderingMiddleware.cs:line 41 at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at Mediachase.Commerce.Anonymous.Internal.AnonymousIdMiddleware.Invoke(HttpContext httpContext) at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

`

gatisb commented 2 years ago

problem was: reused the same name that had type LinkItemCollection before, so all is fine