Has anyone seen this happen before? We just ran into this problem again and I would like to know why this is happening.
Comparing this error version to a working database the problem seems to be in the MigrationHistory table.
The Marketing package tries to load the database version by looking in the __MigrationHistory table, searching for records with the contextKey "Testing.Migrations.Configuration" but no records exist with this key in the error database. Only entries with the ContextKey 'DbLocalizationProvider.LanguageEntities' remain.
What could possibly result in the removal of the other records in this table?
We are running into the same problem, out of the blue. It worked before the weekend and not working with A/B testing for a while.
Using episerver framework/CMS 11.15.1
I have no idea what might have caused this, but the workaround seems to be running the sql in EPiServer.Marketing.Testing.2.6.10\tools\epiupdates\sql
you probably just need to run the latest file (188.8.131.52.sql)
Whoa! Seeing tables and indexes having been created, the MigrationTable has no records of Marketing-stuff.
Looked into test database and comparing to the development database seeing multiple occurences so somehow the migration history in the development databas seems to be emptied.
Thanks for the push in the right direction.
So the marketing tables and indexes seems to be in place but not the migration table rows.
Is this the issue, you think?
Just running 184.108.40.206.sql did not cut it.
Turns out the rows in Migration table is there but in ContextKey 'DbLocalizationProvider.LanguageEntities' instead.
Is Valdis to blame here? ;)
Anyhow. Having ensured that allt changes is in place and Migration History includes all 8 rows, I am getting the same error.
[InvalidOperationException: Sekvensen innehåller inga element] System.Linq.Enumerable.First(IEnumerable`1 source) +455 EPiServer.Marketing.KPI.Dal.BaseRepository.GetDatabaseVersion(String contextKey) +541 EPiServer.Marketing.KPI.DataAccess.KpiDataAccess.GetDatabaseVersionHelper(IRepository repo, String contextKey) +35 EPiServer.Marketing.KPI.DataAccess.KpiDataAccess.GetDatabaseVersion(DbConnection dbConnection, String schema, String contextKey) +126 EPiServer.Marketing.KPI.SchemaUpdater.DatabaseVersionValidator.GetStatus(IEnumerable`1 connectionStringOptions) +178 EPiServer.Data.SchemaUpdates.Internal.<>c__DisplayClass6_0.<EnsureDatabaseSchema>b__0(ISchemaUpdater u) +66 System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +241 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +526 System.Linq.Enumerable.ToList(IEnumerable`1 source) +69 EPiServer.Data.SchemaUpdates.Internal.DatabaseSchemaManagerImplementation.EnsureDatabaseSchema(DataAccessOptions dataAccessOptions) +193 EPiServer.Data.DataInitialization.Initialize(InitializationEngine context) +31 EPiServer.Framework.Initialization.Internal.ModuleNode.Execute(Action a, String key) +58 EPiServer.Framework.Initialization.Internal.ModuleNode.Initialize(InitializationEngine context) +123 EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +275 [InitializationException: Initialize action failed for Initialize on class EPiServer.Data.DataInitialization, EPiServer.Data, Version=220.127.116.11, Culture=neutral, PublicKeyToken=8fe83dea738b45b7] EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +836 EPiServer.Framework.Initialization.InitializationEngine.ExecuteTransition(Boolean continueTransitions) +194 EPiServer.Framework.Initialization.InitializationModule.EngineExecute(HostType hostType, Action`1 engineAction) +885 EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +226 EPiServer.Global..ctor() +42 Mau.Epi.EPiServerApplication..ctor() in C:\Users\myuser\source\repos\Site.Epi\Site\Site.Epi\Global.asax.cs:13 ASP.global_asax..ctor() +48
Edit: I found another row that was not set in Migration table. Fixing this made the site working again
This is a problem that's happened for the second time in our project now. We suddenly get this error in episerver. (episerver cms 11.13.2 with commerce)
Last time we fixed this by reverting the CMS database to an earlier version (in Azure). But I would like to know what couses this.
Server Error in '/' Application.
Sequence contains no elements
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Sequence contains no elements
The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:
1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
<%@ Page Language="C#" Debug="true" %>
2) Add the following section to the configuration file of your application:
Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4075.0